Payments by API
Use the following request to submit a PayPal payment that authorises and settles funds in a single step. How you integrate depends on how you are processing payments with us, see below for specific information.
Both products allow the customer to return to the checkout (ours if you are using the PaySuite Payment Page, yours if you are using Your Payment Page) if they decide to Cancel the payment at PayPal.
When using Your Payment Page
If you are using Your Payment Page, you will need to pass your customer to PayPal so they can logon. When you do that we suspend the transaction. Once your customer has finished making their Payment at PayPal you will need to resume the transaction with us so we can complete our processing.
API examples
Payment with PayPal
POST /acceptor/rest/transactions/{instId}/payment{
"transaction": {
"currency": "GBP",
"amount": 100,
"description": "Sample Transaction",
"merchantRef": "mer_txn_1234556",
"commerceType": "MOTO",
"channel": "WEB"
},
"paymentMethod": {
"paypal": {
"returnUrl": "http://merchant-returnUrl.com",
"cancelUrl": "http://merchant-cancelUrl.com"
}
},
"customer": {
"merchantRef": "mer_cust_131241412",
"displayName": "John Smith",
"billingAddress": {
"line1": "1 Some Street",
"city": "Metropolis",
"postcode": "AA1 2BB",
"countryCode": "GBR"
},
"email": "[email protected]",
"telephone": "0123 456 789",
"defaultCurrency": "GBP",
"ip": "212.58.253.67"
}
}curl -X POST "{targetEnvironmentPath}/acceptor/rest/transactions/{instId}/payment" \
-u "{apiUser}:{apiPassword}" \
-H "Content-Type: application/json" \
-d '{
"transaction": {
"currency": "GBP",
"amount": 100,
"description": "Sample Transaction",
"merchantRef": "mer_txn_1234556",
"commerceType": "MOTO",
"channel": "WEB"
},
"paymentMethod": {
"paypal": {
"returnUrl": "http://merchant-returnUrl.com",
"cancelUrl": "http://merchant-cancelUrl.com"
}
},
"customer": {
"merchantRef": "mer_cust_131241412",
"displayName": "John Smith",
"billingAddress": {
"line1": "1 Some Street",
"city": "Metropolis",
"postcode": "AA1 2BB",
"countryCode": "GBR"
},
"email": "[email protected]",
"telephone": "0123 456 789",
"defaultCurrency": "GBP",
"ip": "212.58.253.67"
}
}'{
"clientRedirect": {
"type": "REDIRECT",
"url": "https://www.sandbox.paypal.com/cgi-bin/webscr?cmd=_express-checkout&token=EC-19N35258J27922454&useraction=commit",
"frame": "TOP"
},
"paymentMethod": {
"paymentClass": "PAYPAL"
},
"customer": {
"merchantRef": "mer_cust_131241412"
},
"transaction": {
"transactionId": "13625805484",
"merchantRef": "mer_txn_1234556",
"status": "PENDING",
"type": "PAYMENT",
"amount": 100,
"consumerSpend": 0,
"currency": "GBP",
"transactionTime": "2014-08-06T00:22:38.739+01:00",
"receivedTime": "2014-08-06T00:22:38.739+01:00",
"channel": "WEB"
},
"outcome": {
"status": "SUCCESS",
"reasonCode": "U103",
"reasonMessage": "Suspended by PayPal"
},
"link": [
{
"rel": "transaction",
"href": "https://api.mite.pay360.com/acceptor/rest/transactions/9999/13625805484"
}
]
}When using the PaySuite Payment Page
If you are using the PaySuite Payment Page, we will handle the customer redirect to PayPal for you. In order to achieve the best customer experience you may need to send us additional information depending on whether you redirect or iFrame the payment page.
PaySuite Payment Page examples
Hosted Session Initialisation
POST /hosted/rest/sessions/{instId}/payments{
"session": {
"returnUrl": {
"url": "https://www.example.com/transactionResult?MERCHANTREF=931143931143"
}
},
"transaction": {
"merchantReference": "931143931143",
"money": {
"currency": "GBP",
"amount": {}
},
"description": "HFTransactionDescriptionFor-931143931143"
},
"customer": {
"create": true,
"identity": {
"merchantCustomerId": "1111111111111"
},
"details": {
"name": "given1 Family1",
"address": {
"line1": "matched",
"line2": "initialCustomer1AddresssLine2",
"city": "initalCustomer1City",
"region": "initalCustomer1Region",
"postcode": "AVS111",
"countryCode": "GBR"
},
"telephone": "0044111111111",
"emailAddress": "[email protected]",
"ipAddress": "1.1.1.1",
"defaultCurrency": "GBP"
}
},
"customFields": {}
}curl -X POST "{targetEnvironmentPath}/hosted/rest/sessions/{instId}/payments" \
-u "{apiUser}:{apiPassword}" \
-H "Content-Type: application/json" \
-d '{
"session": {
"returnUrl": {
"url": "https://www.example.com/transactionResult?MERCHANTREF=931143931143"
}
},
"transaction": {
"merchantReference": "931143931143",
"money": {
"currency": "GBP",
"amount": {}
},
"description": "HFTransactionDescriptionFor-931143931143"
},
"customer": {
"create": true,
"identity": {
"merchantCustomerId": "1111111111111"
},
"details": {
"name": "given1 Family1",
"address": {
"line1": "matched",
"line2": "initialCustomer1AddresssLine2",
"city": "initalCustomer1City",
"region": "initalCustomer1Region",
"postcode": "AVS111",
"countryCode": "GBR"
},
"telephone": "0044111111111",
"emailAddress": "[email protected]",
"ipAddress": "1.1.1.1",
"defaultCurrency": "GBP"
}
},
"customFields": {}
}'{
"sessionId": "c904e5dc-c84e-4727-9364-8445af570218",
"redirectUrl": "https://secure.mite.pay360.com/hosted/97c79839-75cb-4b9e-a1a6-35e79bef7e78/begin/c904e5dc-c84e-4727-9364-8445af570218",
"status": "SUCCESS"
}Hosted Session Initialisation - iFramed
POST /hosted/rest/sessions/{instId}/payments{
"session": {
"returnUrl": {
"url": "https://www.example.com/transactionResult?MERCHANTREF=572117572117"
},
"restoreUrl": {
"url": "https://www.example.com/restore"
}
},
"transaction": {
"merchantReference": "572117572117",
"money": {
"currency": "GBP",
"amount": {}
},
"description": "HFTransactionDescriptionFor-572117572117"
},
"customer": {
"create": true,
"identity": {
"merchantCustomerId": "1111111111111"
},
"details": {
"name": "given1 Family1",
"address": {
"line1": "matched",
"line2": "initialCustomer1AddresssLine2",
"city": "initalCustomer1City",
"region": "initalCustomer1Region",
"postcode": "AVS111",
"countryCode": "GBR"
},
"telephone": "0044111111111",
"emailAddress": "[email protected]",
"ipAddress": "1.1.1.1",
"defaultCurrency": "GBP"
}
},
"customFields": {}
}curl -X POST "{targetEnvironmentPath}/hosted/rest/sessions/{instId}/payments" \
-u "{apiUser}:{apiPassword}" \
-H "Content-Type: application/json" \
-d '{
"session": {
"returnUrl": {
"url": "https://www.example.com/transactionResult?MERCHANTREF=572117572117"
},
"restoreUrl": {
"url": "https://www.example.com/restore"
}
},
"transaction": {
"merchantReference": "572117572117",
"money": {
"currency": "GBP",
"amount": {}
},
"description": "HFTransactionDescriptionFor-572117572117"
},
"customer": {
"create": true,
"identity": {
"merchantCustomerId": "1111111111111"
},
"details": {
"name": "given1 Family1",
"address": {
"line1": "matched",
"line2": "initialCustomer1AddresssLine2",
"city": "initalCustomer1City",
"region": "initalCustomer1Region",
"postcode": "AVS111",
"countryCode": "GBR"
},
"telephone": "0044111111111",
"emailAddress": "[email protected]",
"ipAddress": "1.1.1.1",
"defaultCurrency": "GBP"
}
},
"customFields": {}
}'{
"sessionId": "c904e5dc-c84e-4727-9364-8445af570218",
"redirectUrl": "https://secure.mite.pay360.com/hosted/97c79839-75cb-4b9e-a1a6-35e79bef7e78/begin/c904e5dc-c84e-4727-9364-8445af570218",
"status": "SUCCESS"
}