To use PayPal you must first open a PayPal business account, and connect it to WhenThen Settings → Connections.
For general instruction how to connect payment processor connection see getting started
If you are new to PayPal, the best place to start is by registering for a PayPal developer accounthere
Once a developer account is established, follow PayPal’s documentation and setting up a new REST application. You will need the appropriate Client ID and Secret in order to connect a new PayPal connection on WhenThen platform.
Example authorizePayment
using PayPal - use PAYAPL
as the type
for the paymentMethod
.
curl
-X POST
-H "Content-Type: application/json"
-H "Authorization: Bearer xxxxxxx"
-d '{
"query": "mutation authorizePayment($authorisePayment: AuthorisedPaymentInput!) {
authorizePayment(authorisePayment: $authorisePayment) {
id
status
}
}",
"variables": {
"authorisePayment": {
"orderId": "5113e019-9316-4498-a16d-4343fda403eb",
"flowId": "0c6d975e-f586-4fa6-8caf-863e69ac78d6",
"amount": 1200,
"currencyCode": "USD",
"apmRedirectUrl": "http://valid-url-to-merchant-callback-endpoint.io",
"paymentMethod":{
"type": "PAYPAL"
}
}
}
}'
https://api.whenthen.com/api/graphql
When an authorizePayment
call is made, WhenThen will initiate a request to PayPal. In response, PayPal provides WhenThen a checkoutnow URL which we provide to you in a valid error response. See Handle Valid Error Response section for further details.
When the user is redirected to that URL, it will prompt the user to login at PayPal and then present them with page similar to the following to select the payment method they would like complete the transaction:
After your customer selects a payment method type at PayPal and authorizes the payment, they will then be redirected back to your, previously provided APM Redirect URL
with the payment Id. See See Handle Authorization Callback Response section for further details.
Once a successful authorization has occurred, if your automation is using auto capture then no futher actions is required. Otherwise you should call the Capture API .