-
only for EMBEDDED
(skin ID: 7 – the merchant should have a default skinid that has asigned skin layout 5 – compact_iframe_layout_v1):
-
for all other cases:
Definition: DELETE /v1/preapprovals/{id}
To close a preapproval, you must send a DELETE action for an existing preapproval object. See below our examples for closing a preapproval for MercadoPago (46) and SEPA Direct Debit (84).
Request:
DELETE https://paytest.smart2pay.com/v1/preapprovals/4217
Authorization: Basic MzAyMDE6aEo1Um9iWXg5cjdGZk53Q3ZIWTlMWEhxcXIrRkV6cmM3YUp2UVFrNEdhejFtZzdSeXk=
Response:
HTTP/1.1 200 OK
Content-Type: application/json; charset=utf-8
{
"Preapproval": {
"ID": 4217,
"Created": "20170804065155",
"MethodID": 46,
"SiteID": 30201,
"MerchantPreapprovalID": "s2ptest_g107",
"RecurringPeriod": 0,
"PreapprovedMaximumAmount": null,
"Currency": null,
"ReturnURL": "http://demo.smart2pay.com/redirect.php",
"Description": "1 year subscription update1",
"Customer": {
"ID": 3627,
"MerchantCustomerID": null,
"Email": "test_user_83022133@testuser.com",
"FirstName": "John",
"LastName": "Doe",
"Gender": null,
"SocialSecurityNumber": null,
"Phone": "0765260000",
"Company": null,
"DateOfBirth": null
},
"BillingAddress": {
"ID": 1257,
"City": "Rio de Janeiro",
"ZipCode": "23900-000",
"State": null,
"Street": "Tonelero",
"StreetNumber": "1",
"HouseNumber": null,
"HouseExtension": null,
"Country": "BR"
},
"Status": {
"ID": 4,
"Info": "ClosedByCustomer",
"Reasons": null
},
"RedirectURL": null,
"MethodOptionID": 0,
"PreapprovedFrequency": null,
"MandateReference": null
}
}
Request:
DELETE https://paytest.smart2pay.com/v1/preapprovals/12351
Authorization: Basic MzAyMDE6aEo1Um9iWXg5cjdGZk53Q3ZIWTlMWEhxcXIrRkV6cmM3YUp2UVFrNEdhejFtZzdSeXk=
Response:
HTTP/1.1 200 OK
Content-Type: application/json; charset=utf-8
{
"Preapproval": {
"ID": 12351,
"Created": "20180912102819",
"MethodID": 84,
"SiteID": 30201,
"MerchantPreapprovalID": "s2ptest_f102",
"RecurringPeriod": 0,
"PreapprovedMaximumAmount": null,
"Currency": null,
"ReturnURL": "http://demo.smart2pay.com/redirect.php",
"Description": "SEPA DD preapproval request",
"Customer": {
"ID": 114724,
"MerchantCustomerID": null,
"Email": "youremail@gmail.com",
"FirstName": "John",
"LastName": "Smith",
"Gender": null,
"SocialSecurityNumber": null,
"SocialSecurityNumber2": null,
"Phone": "+4976526000",
"Company": "Smart2Pay",
"DateOfBirth": null
},
"BillingAddress": {
"ID": 4796,
"City": "Oyenhausen",
"ZipCode": "32547",
"State": null,
"Street": "Schulstrasse",
"StreetNumber": "4",
"HouseNumber": null,
"HouseExtension": null,
"Country": "DE"
},
"Status": {
"ID": 4,
"Info": "ClosedByCustomer",
"Reasons": null
},
"RedirectURL": null,
"MethodOptionID": 0,
"PreapprovedFrequency": null,
"MandateReference": null
}
}
Code sample: Authentication
curl -u {PROVIDED_SITE_ID}:{PROVIDED_API_KEY} \
https://paytest.smart2pay.com/v1/payments/?limit=1
s2p-alert
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.
Test information message – class=”s2p-warn”
Test information message – class=”s2p-info”
s2p-resp
Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.
Authorization: Basic VWhsT0xtb0RGbzFaSEdWekx1N0hxNGhWUEhZY3VQUUg6
{
"Payment": {
"PreapprovalID":828,
"MerchantTransactionID": "990121122769",
"Amount": "100",
"Currency": "BRL",
"Customer": {
"Email" : "test_user_59479683@testuser.com"
}
}
}
s2p-req
Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur.
Authorization: Basic VWhsT0xtb0RGbzFaSEdWekx1N0hxNGhWUEhZY3VQUUg6
{
"Payment": {
"PreapprovalID":828,
"MerchantTransactionID": "990121122769",
"Amount": "100",
"Currency": "BRL",
"Customer": {
"Email" : "test_user_59479683@testuser.com"
}
}
}
s2p-def
Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
s2p-def-items
Sed ut perspiciatis unde omnis iste natus error sit voluptatem accusantium doloremque laudantium.
Totam rem aperiam, eaque ipsa quae ab illo inventore veritatis et quasi architecto beatae vitae dicta sunt explicabo. Nemo enim ipsam voluptatem quia voluptas sit aspernatur aut odit aut fugit, sed quia consequuntur magni dolores eos qui ratione voluptatem sequi nesciunt.