Definition: POST /v1/preapprovals
To initiate a preapproval, you must create a preapproval object. The parameters of the preapproval are sent in the message body as a JSON object. See below an example of a preapproval request for Truemoney (1143).
Request:
POST https://paytest.smart2pay.com/v1/preapprovals
Authorization: Basic MzAyMDE6KzlLZUd6S0Y3VzhTLzc5YTVSMzNZSlVnN0U3V0ZOY1piakdmekxWM2JYU25GQ095RnQ=
{
"Preapproval": {
"MerchantPreapprovalID": "s2ptest_truemoney3",
"Currency": "THB",
"Description": "1 year subscription",
"ReturnURL": "http://demo.smart2pay.com/redirect.php",
"MethodID": 1143,
"Customer": {
"FirstName": "John",
"LastName": "Doe",
"Email": "jdoe@gmail.com"
},
"BillingAddress": {
"Country": "TH"
}
}
}
Response:
HTTP/1.1 201 Created
Content-Type: application/json; charset=utf-8
{
"Preapproval": {
"ID": 28076,
"Created": "20210202153841",
"MethodID": 1143,
"SiteID": 30201,
"MerchantPreapprovalID": "s2ptest_truemoney3",
"RecurringPeriod": 0,
"PreapprovedMaximumAmount": null,
"Currency": "THB",
"ReturnURL": "http://demo.smart2pay.com/redirect.php",
"Description": "1 year subscription",
"Customer": {
"ID": 2625948,
"MerchantCustomerID": null,
"Email": "jdoe@gmail.com",
"FirstName": "John",
"LastName": "Doe",
"Gender": null,
"SocialSecurityNumber": null,
"Phone": null,
"Company": null,
"DateOfBirth": null
},
"BillingAddress": {
"ID": 1540,
"City": null,
"ZipCode": null,
"State": null,
"Street": null,
"StreetNumber": null,
"HouseNumber": null,
"HouseExtension": null,
"Country": "TH"
},
"Status": {
"ID": 1,
"Info": "Pending",
"Reasons": null
},
"RedirectURL": "https://europaytest.smart2pay.com/AlipayOSP/Preapproval/PreapprovalLanding.aspx?ID=23259&Hash=50143980E584E7DEE54CBA48BA1EC543",
"MethodOptionID": 0,
"PreapprovedFrequency": null,
"MandateReference": null,
"Details": null
}
}
Truemoney Preapproval Flow
Truemoney Test Data | ||
---|---|---|
Data | Value | |
Phone Number: | Enter any 10 digit number. Example: 1234567812 | |
Password: | Enter any 4 digit number. Example: 1234 |