promotions
Stable. Describes behaviour that is built and covered by tests in this repository.
POST /v1/promotions/quote #
What a code would take off a purchase (claims nothing)
For a checkout page of your own. The answer is the discount or the bonus credits, or an error with a coupon.* key: coupon.expired, coupon.exhausted, coupon.not_applicable, coupon.currency_mismatch, coupon.already_used and the others in the error key list.
Request body
| Field | Type | Description |
|---|---|---|
code | string | |
customer_external_id | string | Needed by codes that are first-purchase-only or one per customer |
target required | COUPON_TARGET_CREDIT_PURCHASE | COUPON_TARGET_PAYMENT | |
amount_minor | string | The price before the discount, format: int64 |
currency required | string | |
item | string | The credit pack id, for codes restricted to some packs |
credits | string | The credits sold, for a bonus coupon |
prior_purchases | boolean | The customer has paid for something before |
Example
{
"target": "COUPON_TARGET_CREDIT_PURCHASE",
"currency": "string"
}Responses
| Status | Meaning | Body |
|---|---|---|
200 | OK | PromotionQuote |
400 | Error envelope | Error |
404 | Error envelope | Error |
409 | Error envelope | Error |
Example response
{
"applied": false,
"coupon_code": "string",
"coupon_name": "string",
"promotion_code": "string",
"discount_minor": "string",
"bonus_credits": "string",
"total_minor": "string",
"currency": "string",
"redemption_id": "string"
}curl
curl -X POST https://YOUR-API-ADDRESS/v1/promotions/quote \
-H "Authorization: Bearer $PAYRUDDER_API_KEY" \
-H "Content-Type: application/json" \
-d '{"target":"COUPON_TARGET_CREDIT_PURCHASE","currency":"string"}'Models
Error
| Field | Type | Description |
|---|---|---|
error required | object |
PromotionQuote
| Field | Type | Description |
|---|---|---|
applied required | boolean | |
coupon_code required | string | |
coupon_name required | string | |
promotion_code required | string | |
discount_minor required | string · int64 | |
bonus_credits required | string · int64 | |
total_minor required | string · int64 | The price after the discount, never below zero |
currency required | string | |
redemption_id required | string |
PromotionQuoteRequest
| Field | Type | Description |
|---|---|---|
code | string | |
customer_external_id | string | Needed by codes that are first-purchase-only or one per customer |
target required | COUPON_TARGET_CREDIT_PURCHASE | COUPON_TARGET_PAYMENT | |
amount_minor | string | The price before the discount, format: int64 |
currency required | string | |
item | string | The credit pack id, for codes restricted to some packs |
credits | string | The credits sold, for a bonus coupon |
prior_purchases | boolean | The customer has paid for something before |