you can use our client Javascript library, to accept payment from customers
email
, amount
, transaction reference
, etc.
The key, email
and amount
parameters are the only required parameters. The table below lists the parameters that you can pass when initializing a transaction.
Param | Required | Description |
---|---|---|
merchantKey | Yes | Your public key from PaywithSwwipe. Use test key for test mode and live key for live mode |
email | Yes | Email address of customer |
amount | Yes | Amount(in the lowest currency value -kobo) you are debiting customer. |
reference | Yes | Unique case sensitive transaction reference. If you do not pass this parameter, PaywithSwwipe will generate a unique reference for you. |
currencyCode | No | Currency charge should be performed in. Allowed value is: NGN |
callback | No | Function that runs when a payment is successful. This should ideally be a script that uses the verify endpoint on the PaywithSwwipe API to check the status of the transaction |
onClose | No | JavaScript function that is called if the customer closes the payment window instead of making payment. |
pay
button has been tied to an onClick
function called payWithSwwipe
.
This is the action that causes SwwipePay library popup to load.merchantKey
field here takes your PaywithSwwipe publickey.amount
field has to be converted to the lowest currency unit by multiplying the value by 100
so if you wanted to charge** N50**, you have to multiply** 50 * 100** and pass 5000 in the amount field.reference
from your system for every transaction to avoid duplicate attempts.callback
method is called when payment has been completed successfully on the PaywithSwwipe checkout. See the next section to see how to hand the callback.onClose
method is called if the user closes the modal without completing payment.Parameter | Description |
---|---|
data.status | This indicates if the payment is successful or not |
data.amount | This indicates the price of your product or service in the lower denomination (e.g for NGN 50, you’d see 5000 and so on) |
🚧 Verify Amount When verifying the status of a transaction, you should also verify the amount to ensure it matches the value of the service you are delivering. If the amount doesn’t match, do not deliver value to the customer.