Accept Payments

πŸ‘

In a nutshell

To accept a payment, create a transaction using our inline checkout, libraries, payment link,or our SDKs.

SPay provides a simple way to integrate a checkout feature into your existing products. This is the fastest and easiest way to get paid online with minimal code required for integration.

Some of the benefits of using the web checkout flow are:

  1. Ease of integration
  2. Secured checkout experience
  3. Various payment options to enable

Payment Options

  • Pay with Cards
  • 1226
  • Pay with USSD
  • 1258
  • Pay with Transfer
  • 1282

    Initialise Payment

    To initialise the transaction, you'll need to pass information such as email, first name, last name amount, transaction reference, etc. Email and amount are required. Here is the full list of parameters you can pass:

    Payment Request Parameters

    ParamRequired?Description
    amountYesAmount you are debiting customer.
    NB: Amount is in major denomination - Naira)
    currencyYesCurrency charge should be performed in. Allowed values is: NGN.
    referenceYesMerchant generated transaction reference
    merchantCodeYesThe Merchant's code
    customerYesObject containing customer information you want recorded with the transaction. Fields within the customer object are:
    firstName, lastName, phone and email.
    firstNameYesCustomer first name | given name
    lastNameYesCustomer last name | Surname
    phoneYesCustomer phone number
    emailYesCustomer email address
    callbackYesFunction that runs when payment is completed; successful or not successful. The callback function that returns the state of a transaction.
    onCloseNoFunction that is called if the customer closes the payment window instead of making a payment.

    Payment Response Parameters

    ParamRequired?Description
    amountYesAmount customer was debited.
    NB: Amount is in major denomination - Naira)
    channelYesPayment channel; WEB, API, Transfer or USSD
    dateYesTransaction date and time
    metaYesObject containing any extra information you want recorded with the transaction. contains fields such as the custom_field and the processor id
    paymentMethodYesPayment method; Card, Transfer or USSD
    referenceYesMerchant generated transaction reference
    statusYesStatus of the transaction; FAILED, SUCCESS or PENDING
    idYesthe unique id of the transaction at our end

    πŸ“˜

    Go Live

    To go live, update your merchant code to its live equivalent and switch the javascript and CSS link to live endpoint below:

    Javascript: https://checkout.spaybusiness.com/pay/static/js/spay_checkout.js
    CSS: https://checkout.spaybusiness.com/pay/static/css/spay_checkout.css

    Sample Code

    <html lang="en">
      <head>
        <meta charset="UTF-8" />
        <meta http-equiv="X-UA-Compatible" content="IE=edge" />
        <meta name="viewport" content="width=device-width, initial-scale=1.0" />
        <link
          href="https://testcheckout.spaybusiness.com/pay/static/css/spay_checkout.css"
          rel="stylesheet"
        />
        <title>Document</title>
      </head>
      <body>
        <button id="payWithSpay" onclick="payWithSpay()">Pay With Spay</button>
      </body>
      <script
        type="text/javascript"
        src="https://testcheckout.spaybusiness.com/pay/static/js/spay_checkout.js"></script>
    </html>
    
    function payWithSpay() {
      var handler = {
        amount: 50,
        currency: "NGN",
        reference: "spay-9092400324932",
        merchantCode: "MCH_la8whiqumgh489i",
        customer: {
          firstName: "Test",
          lastName: "Test",
          phone: "0813575SPAY",
          email: "[email protected]",
        },
        callback: function (response) {
          console.log("do something with response");
        },
        onClose: function () {
          console.log("do something before closing");
        },
      };
    
      window.SpayCheckout.init(handler);
    }
    

    Retrieve Your Live Merchant Code

    Login to your account
    Toggle to Live

    3332

    Click settings

    3332

    Click Api Keys & Merchant Code and copy the live merchant code

    3352

    What’s Next