Search…
API Reference
Resources
Create a stripe gateway
How to create a stripe gateway via API
To create a new stripe gateway, send a POST request to the /api/stripe_gateways endpoint, passing the resource arguments in the request body.

Request

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

Arguments

Body Parameter
Type
Required
type
string
Required
attributes.name
string
Required
attributes.reference
string
Optional
attributes.reference_origin
string
Optional
attributes.metadata
object
Optional
attributes.login
string
Required
attributes.publishable_key
string
Optional

Example

Request
Response
The following request creates a new stripe gateway:
1
curl -g -X POST \
2
'https://yourdomain.commercelayer.io/api/stripe_gateways' \
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": "stripe_gateways",
9
"attributes": {
10
"name": "US payment gateway",
11
"login": "sk_live_xxxx-yyyy-zzzz"
12
}
13
}
14
}'
Copied!
On success, the API responds with a 201 Created status code, returning the created resource object:
1
{
2
"data": {
3
"id": "xYZkjABcde",
4
"type": "stripe_gateways",
5
"links": {
6
"self": "https://yourdomain.commercelayer.io/api/stripe_gateways/xYZkjABcde"
7
},
8
"attributes": {
9
"name": "US payment gateway",
10
"created_at": "2018-01-01T12:00:00.000Z",
11
"updated_at": "2018-01-01T12:00:00.000Z",
12
"reference": "ANY-EXTERNAL-REFEFERNCE",
13
"reference_origin": "ANY-EXTERNAL-REFEFERNCE-ORIGIN",
14
"metadata": {
15
"foo": "bar"
16
},
17
"webhook_endpoint_id": "xxxx-yyyy-zzzz",
18
"webhook_endpoint_secret": "xxxx-yyyy-zzzz",
19
"webhook_endpoint_url": "https://core.commercelayer.co/webhook_callbacks/stripe_gateways/xxxxx"
20
},
21
"relationships": {
22
"payment_methods": {
23
"links": {
24
"self": "https://yourdomain.commercelayer.io/api/stripe_gateways/xYZkjABcde/relationships/payment_methods",
25
"related": "https://yourdomain.commercelayer.io/api/stripe_gateways/xYZkjABcde/payment_methods"
26
}
27
},
28
"stripe_payments": {
29
"links": {
30
"self": "https://yourdomain.commercelayer.io/api/stripe_gateways/xYZkjABcde/relationships/stripe_payments",
31
"related": "https://yourdomain.commercelayer.io/api/stripe_gateways/xYZkjABcde/stripe_payments"
32
}
33
}
34
},
35
"meta": {
36
"mode": "test"
37
}
38
}
39
}
Copied!
Last modified 2mo ago
Copy link