Fetch promotion is triggered to fetch available GoPay promotions based on user account and transaction amount. Merchants can then show the available promotion on the merchant's page and have customers pre-select the promo and apply it when charging.
This feature is only available for GoPay Tokenization.
Fetch Promotion currently is only available in Production.
To enable Fetch Promotion, please contact your Midtrans Sales PIC or Midtrans Support.
Fetch Promotion Request
HTTP Method | Endpoint | Definition |
---|---|---|
GET | BASE_URL/v2/gopay/promo/{account_id}?gross_amount={gross_amount}¤cy={currency} | Fetch available promotions |
JSON Attribute | Description | Type | Required |
---|---|---|---|
account_id | Customer account id to be used for payment | String | Required |
gross_amount | Transaction gross amount | String | Required |
currency | Transaction currency. Default: IDR | String | Optional |
Fetch Promotion Response
{
"account_id": "00000269-7836-49e5-bc65-e592afafec14",
"status_code": "200",
"recommended_promotion_id": "CASHBACK|acbec7d4-b30b-44ac-9c42-f5d767419a72|8bb3c041-c71e-40f3-892b-688fda2ec979||2021-02-22|2021-02-23",
"promotions": [
{
"id": "CASHBACK|acbec7d4-b30b-44ac-9c42-f5d767419a72|8bb3c041-c71e-40f3-892b-688fda2ec979||2021-02-22|2021-02-23",
"code": "100PCCASHBACK",
"type": "CASHBACK",
"actual_payable_amount": "100.00",
"promotion_amount": "100.00",
"minimum_applicable_amount": "100.00",
"currency": "IDR/SGD/VND/THB",
"description": "100 percent cashback",
"short_description": "short-desc",
"title": "100PCCASHBACK",
"valid_from": "2021-02-22 17:00:00",
"valid_till": "2021-02-23 17:00:00",
"tnc_url": "",
"limit_per_user": 15,
"source": "GOPAY_PROMO",
"promotion_value": {
"money": {
"type": "PERCENTAGE",
"value": "100"
}
}
}
]
}
{
"account_id": "00000269-7836-49e5-bc65-e592afafec14",
"status_code":"200",
"promotions":[]
}
{
"id": "00000269-7836-49e5-bc65-e592afafec14",
"status_code": "400",
"status_message": "Account doesn’t exist"
}
{
"id": "00000269-7836-49e5-bc65-e592afafec1",
"status_code": "400",
"status_message": "One or more parameters in the payload is invalid.",
"validation_messages": [“gross_amount is required”]
}
JSON Attribute | Description | Type | |
---|---|---|---|
account_id | Customer account id to be used for payment | String | |
status_code | Status code of the API result | String | |
recommended_promotion_id | Recommended promotion id based on order details | String | |
promotions | List of applicable GoPay promotion information | Array | |
id | Promotion id. Will be used in Charge API to apply promotion. | String | |
code | Promotion code | String | |
type | Promotion type | String | |
actual_payable_amount | Transaction gross amount | String | |
promotion_amount | Promotion/cashback amount | String | |
minimum_applicable_amount | Minimum transaction amount for promotion | String | |
currency | Currency | String | |
description | Promotion description | String | |
title | Promotion title | String | |
valid_from | Start of promotion period | String | |
valid_till | End of promotion period | String | |
tnc_url | Terms & condition url | String | |
limit_per_user | Maximum usage per user within promotion period | String | |
source | Promotion source | String | |
promotion_value | Promotion value | Object | |