routing-rules
Stable. Describes behaviour that is built and covered by tests in this repository.
GET /v1/routing-rules #
The ordered rules that choose a new subscription's payment provider from the customer's country and the subscription's currency
Responses
| Status | Meaning | Body |
|---|---|---|
200 | OK | RoutingRules |
Example response
{
"rules": [
{
"country": "string",
"currency": "string",
"provider": "string"
}
]
}curl
curl -X GET https://YOUR-API-ADDRESS/v1/routing-rules \
-H "Authorization: Bearer $PAYRUDDER_API_KEY"PUT /v1/routing-rules #
Replace the rules (first match wins; a rule with neither country nor currency is the catch-all and must be last). Existing subscriptions keep their provider
Request body
| Field | Type | Description |
|---|---|---|
rules | array of object |
Example
{}Responses
| Status | Meaning | Body |
|---|---|---|
200 | OK | RoutingRules |
400 | Error envelope | Error |
Example response
{
"rules": [
{
"country": "string",
"currency": "string",
"provider": "string"
}
]
}curl
curl -X PUT https://YOUR-API-ADDRESS/v1/routing-rules \
-H "Authorization: Bearer $PAYRUDDER_API_KEY" \
-H "Content-Type: application/json" \
-d '{}'POST /v1/routing-rules/preview #
Where a customer in a country paying in a currency would go, without creating anything
Request body
| Field | Type | Description |
|---|---|---|
country | string | |
currency | string |
Example
{}Responses
| Status | Meaning | Body |
|---|---|---|
200 | OK | PreviewRoutingResponse |
Example response
{
"provider": "string",
"rule_index": 1,
"owner": "payrudder",
"can_charge": false
}curl
curl -X POST https://YOUR-API-ADDRESS/v1/routing-rules/preview \
-H "Authorization: Bearer $PAYRUDDER_API_KEY" \
-H "Content-Type: application/json" \
-d '{}'Models
Error
| Field | Type | Description |
|---|---|---|
error required | object |
PreviewRoutingRequest
| Field | Type | Description |
|---|---|---|
country | string | |
currency | string |
PreviewRoutingResponse
| Field | Type | Description |
|---|---|---|
provider required | string | Empty when no rule matches (the tenant's default account) |
rule_index required | integer | -1 when no rule matches |
owner required | payrudder | provider | |
can_charge required | boolean |
RoutingRules
| Field | Type | Description |
|---|---|---|
rules required | array of object |
RoutingRulesInput
| Field | Type | Description |
|---|---|---|
rules | array of object |