You must have a Paypal account and obtain their client ID and client secret ID, and use them to obtain OAuth access token and req request all other APIs by attaching on the Authorization
header.
Sadly I am Taiwanese, so I can't give useful notes as it shows: Integration Builder is currently available in US only. We will be expanding this tool globally shortly.
But we can still use their API.
Here, you need some test accounts from: Sandbox test accounts.
Also, see Card testing.
You need at least one param: client-id
. There are two params provided in the example repo:
Finally, add the https://www.paypal.com/sdk/js
SDK like: https://www.paypal.com/sdk/js?client-id=${client-id}&enable-funding=${enable-funding}¤cy=${currency}&intent=${intent}
.
The API used to order in the example repo is /checkout/orders
.
At least intent
and purchase_units
are needed. purchase_units
is an array with some orders:
{
"reference_id": "d9f80740-38f0-11e8-b467-0ed5f89f718b",
"description": "Order",
"amount": {
"currency_code": "USD",
"value": "100.00"
}
}
intent
can decide whether the payment should be immediately (CAPTURE
) or authorised by the owner (AUTHORIZE
) after the order is created.
Then, use /v2/checkout/orders/{id}/capture
or /v2/checkout/orders/{id}/authorize
to confirm the order.