Search…
API Reference
Resources
Create a billing info validation rule
How to create a billing info validation rule via API
To create a new billing info validation rule, send a POST request to the /api/billing_info_validation_rules endpoint, passing the resource arguments in the request body.

Request

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

Arguments

Body Parameter
Type
Required
type
string
Required
attributes.reference
string
Optional
attributes.reference_origin
string
Optional
attributes.metadata
object
Optional
relationships.market
object
Required

Example

Request
Response
The following request creates a new billing info validation rule:
1
curl -g -X POST \
2
'https://yourdomain.commercelayer.io/api/billing_info_validation_rules' \
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": "billing_info_validation_rules",
9
"relationships": {
10
"market": {
11
"data": {
12
"type": "markets",
13
"id": "QWERtyUpBa"
14
}
15
}
16
}
17
}
18
}'
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": "billing_info_validation_rules",
5
"links": {
6
"self": "https://yourdomain.commercelayer.io/api/billing_info_validation_rules/xYZkjABcde"
7
},
8
"attributes": {
9
"created_at": "2018-01-01T12:00:00.000Z",
10
"updated_at": "2018-01-01T12:00:00.000Z",
11
"reference": "ANY-EXTERNAL-REFEFERNCE",
12
"reference_origin": "ANY-EXTERNAL-REFEFERNCE-ORIGIN",
13
"metadata": {
14
"foo": "bar"
15
}
16
},
17
"relationships": {
18
"market": {
19
"links": {
20
"self": "https://yourdomain.commercelayer.io/api/billing_info_validation_rules/xYZkjABcde/relationships/market",
21
"related": "https://yourdomain.commercelayer.io/api/billing_info_validation_rules/xYZkjABcde/market"
22
}
23
}
24
},
25
"meta": {
26
"mode": "test"
27
}
28
}
29
}
Copied!
Last modified 2mo ago
Copy link