Search…
API Reference
Resources
Update a paypal payment
How to update an existing paypal payment via API
To update an existing paypal payment, send a PATCH request to the /api/paypal_payments/:id endpoint, where id is the ID of the resource that you want to update.
Here below the list of all the possible arguments that you can pass with the request body.

Request

PATCH https://yourdomain.commercelayer.io/api/paypal_payments/:id

Arguments

Body Parameter
Type
Required
type
string
Required
id
string
Required
attributes.paypal_payer_id
string
Optional
attributes.reference
string
Optional
attributes.reference_origin
string
Optional
attributes.metadata
object
Optional
relationships.order
object
Optional

Example

Request
Response
The following request updates the paypal payment identified by the ID "xYZkjABcde":
1
curl -g -X PATCH \
2
'https://yourdomain.commercelayer.io/api/paypal_payments/xYZkjABcde' \
3
-H 'Accept: application/vnd.api+json' \
4
-H 'Authorization: Bearer your-access-token' \
5
-H 'Content-Type: application/vnd.api+json' \
6
-d '{
7
"data": {
8
"type": "paypal_payments",
9
"id": "xYZkjABcde",
10
"attributes": {
11
"reference": "ANY-EXTERNAL-REFEFERNCE"
12
}
13
}
14
}'
Copied!
On success, the API responds with a 200 OK status code, returning the updated resource object:
1
{
2
"data": {
3
"id": "xYZkjABcde",
4
"type": "paypal_payments",
5
"links": {
6
"self": "https://yourdomain.commercelayer.io/api/paypal_payments/xYZkjABcde"
7
},
8
"attributes": {
9
"return_url": "https://yourdomain.com/thankyou",
10
"cancel_url": "https://yourdomain.com/checkout/payment",
11
"note_to_payer": "Thank you for shopping with us!",
12
"paypal_payer_id": "ABCDEFGHG123456",
13
"name": "ABCDEFGHG123456",
14
"paypal_id": "1234567890",
15
"status": "created",
16
"approval_url": "https://www.paypal.com/cgi-bin/webscr?cmd=_express-checkout&token=EC-1234567890ABCDEFGHG",
17
"created_at": "2018-01-01T12:00:00.000Z",
18
"updated_at": "2018-01-01T12:00:00.000Z",
19
"reference": "ANY-EXTERNAL-REFEFERNCE",
20
"reference_origin": "ANY-EXTERNAL-REFEFERNCE-ORIGIN",
21
"metadata": {
22
"foo": "bar"
23
}
24
},
25
"relationships": {
26
"order": {
27
"links": {
28
"self": "https://yourdomain.commercelayer.io/api/paypal_payments/xYZkjABcde/relationships/order",
29
"related": "https://yourdomain.commercelayer.io/api/paypal_payments/xYZkjABcde/order"
30
}
31
},
32
"payment_gateway": {
33
"links": {
34
"self": "https://yourdomain.commercelayer.io/api/paypal_payments/xYZkjABcde/relationships/payment_gateway",
35
"related": "https://yourdomain.commercelayer.io/api/paypal_payments/xYZkjABcde/payment_gateway"
36
}
37
}
38
},
39
"meta": {
40
"mode": "test"
41
}
42
}
43
}
Copied!
Last modified 20d ago
Copy link