Create Promos API


Create an Order

The following endpoint creates a Promo:

/merchants/promos

Request parameters

Following are the parameters to be sent in the request body:

Fieldis required?Description
amountmandatorystring The amount for which the Promo was created
currencymandatorystring The currency associated with the Promo's amount
labelmandatorystring The label you want to attach with the promotion, has to be unique
descriptionoptionalstring Description of the promotion
typemandatorystring valid values are "card_promos", "ewallet_promos", "va_promos"
sub_typemandatorystring valid values are "direct_discount", "cashback"
min_order_amountmandatorystring denoting minimum order amount on which promo should apply
max_discount_amountmandatorystring denoting maximum discount amount which promo should generate
starts_atmandatorystring
ends_atmandatorystring
discountmandatorystring Depending on discount_type, value is either %discount or flat discount
discount_typemandatorystring valid values are "percentage", "flat"
limit_typemandatorystring valid values are "quota", "budget"
mandatorystring valid values are "total_price", "product_price", "shipping_price"
promo_detailsmandatoryobject Denoting the metadata specific to promo type

Note: Please note that out of bin_list and bank_codes at-least one should be present if promo includes card_promo

Fieldis required?Description
amountmandatorystring The amount for which the Promo was created
currencymandatorystring The currency associated with the Promo's amount
labelmandatorystring The label you want to attach with the promotion, has to be unique
descriptionoptionalstring Description of the promotion
typemandatorystring valid values are "card_promos", "ewallet_promos", "va_promos"
sub_typemandatorystring valid values are "direct_discount", "cashback"
min_order_amountmandatorystring denoting minimum order amount on which promo should apply
max_discount_amountmandatorystring denoting maximum discount amount which promo should generate
starts_atmandatorystring
ends_atmandatorystring
discountmandatorystring Depending on discount_type, value is either %discount or flat discount
discount_typemandatorystring valid values are "percentage", "flat"
limit_typemandatorystring valid values are "quota", "budget"
price_deduction_typemandatorystring valid values are "total_price", "product_price", "shipping_price"
promo_detailsmandatoryobject Denoting the metadata specific to promo type

Example

curl -X POST \
  https://api.durianpay.id/v1/merchants/promos \
  -H 'authorization: [Base64({Your_Server_Key}:)]' \
  -H 'content-type: application/json' \
  -d '{"type":"card_promos","label":"SALE502022","currency":"IDR","promo_details":{"bin_list":[424242],"bank_codes":[]},"discount_type":"percentage","discount":"10","min_order_amount":"","max_discount_amount":"","starts_at":"2022-02-24T18:30:00.000Z","ends_at":"2022-02-27T18:30:00.000Z","promo_type":"","description":"","sub_type":"direct_discount","limit_type":"quota","limit_value":"100","price_deduction_type":"total_price","code":"SALE2022"}'

Response Code : 200

Here is an example of success response

{
    "data": {
        "currency": "IDR",
        "label": "SALE50202",
        "description": "",
        "min_order_amount": "",
        "max_discount_amount": "",
        "starts_at": "2022-02-24T18:30:00Z",
        "ends_at": "2022-02-27T18:30:00Z",
        "discount": "10",
        "discount_type": "percentage",
        "type": "card_promos",
        "promo_details": {
            "promo_id": "prm_rdrZVRIhcq5927",
            "bin_list": [
                424242
            ],
            "bank_codes": []
        },
        "sub_type": "direct_discount",
        "limit_type": "quota",
        "limit_value": "100",
        "price_deduction_type": "total_price",
        "status": "expired",
        "created_at": "2022-03-06T21:55:43.412583Z",
        "updated_at": "2022-03-06T21:55:43.412583Z",
        "is_live": true,
        "promo_usage": "",
        "id": "prm_rdrZVRIhcq5927"
    }
}

Error Response Code : 400

Here is an example error response for invalid request

{
    "error": "error reading request body",
    "error_code": "DPAY_INTERNAL_ERROR",
}

Error Response Code : 401

Here is an example error response for unauthorized access

{
    "error": "invalid Authorization header in request",
    "error_code": "DPAY_UNAUTHORIZED_ACCESS"
}

Error Response Code : 500

Here is an example error response for internal server error

{
    "error": "error creating promo"
}