Create a paypal payment

How to create a paypal payment via API

To create a new paypal payment, send a POST request to the /api/paypal_payments endpoint, passing the resource arguments in the request body.

Request

POST https://yourdomain.commercelayer.io/api/paypal_payments

Arguments

Body ParameterTypeRequired

type

string

Required

attributes.return_url

string

Required

attributes.cancel_url

string

Required

attributes.note_to_payer

string

Optional

attributes.reference

string

Optional

attributes.reference_origin

string

Optional

attributes.metadata

object

Optional

relationships.order

object

Required

Example

The following request creates a new paypal payment:

curl -g -X POST \
  'https://yourdomain.commercelayer.io/api/paypal_payments' \
  -H 'Accept: application/vnd.api+json' \
  -H 'Authorization: Bearer your-access-token' \
  -H 'Content-Type: application/vnd.api+json' \
  -d '{
  "data": {
    "type": "paypal_payments",
    "attributes": {
      "return_url": "https://yourdomain.com/thankyou",
      "cancel_url": "https://yourdomain.com/checkout/payment"
    },
    "relationships": {
      "order": {
        "data": {
          "type": "orders",
          "id": "ABCRtyUpBa"
        }
      }
    }
  }
}'

Last updated