This article is for DEVELOPERS and PARTNERS.


Once Snapplify’s Pay API is implemented, the next step is to validate the Instant Payment Notification (IPN). An IPN is a server-to-server call, where Pay sends a request to a URL specified during the payment request.


IPN is used to enable you to perform additional validation and capture events that change the payment status, such as chargebacks, refunds, and cancellations.


Pay will send an IPN to the URL specified in the payment request on the property notificationUrl. If no notificationUrl is set, no IPN is sent.


Your customer must respond within 15 seconds or the IPN will be considered failed.


A failed IPN response will try to be sent an additional three times. If none are successful, the IPN for that payment will not be sent again. An email will be sent to the customer's email address specified in the setup.


Request


POST https://example.com/pay/ipn
Host: example.com
Content-Type: application/json

Body


{
  "payment": {
    "createdDate": "2018-11-20T13:57:15.000Z",
    "updatedDate": "2018-11-20T15:20:05.000Z",
    "authorisationCode": "ad104788-72d4-444e-9a2e-1325ae1bcc10",
    "referenceCode": "9834538b-26d9-49a2-96a2-55ec81345a81",
    "transactionId": "d993600a-d190-408d-b6c7-49c87b59ab2a",
    "gatewayId": "MOCK",
    "gatewayProvider": "MOCK",
    "completedDate": "2018-11-20T13:57:27.000Z",
    "country": "ZA",
    "currency": "USD",
    "amount": 321.99,
    "paymentMethod": "Credit Card",
    "paymentState": "COMPLETED",
    "errorMessage": null,
    "errorCode": null,
    "validated": true,
    "validatedDate": "2018-11-20T15:20:05.000Z",
    "validatedToken": "e29ae94e-d8c6-4c1f-a927-2543423121c7"
  }
}


Validation

The Pay IPN must be sent back to Pay to validate that it is a legitimate IPN.


Request


POST https://pay.snapplify.com/payment/ipn/validate?
client=XXX&secret=XXX
Host: example.com
Content-Type: application/json
{
  "payment": {
    … The same data that was sent in the IPN request …
  }
}


Query String


These query strings are available:


NameValueRequired

client

StringYes

secret

StringYes


Response


Pay will respond with an HTTP status code of 200 and a body that contains either VERIFIED or INVALID.


Example:


VERIFIED



Learn more about:



Need help? Use the live chat in the bottom right corner of your screen or email us at help@snapplify.com.