v2 for Merchant/Partner API contract
Definitions
Key Description Data type Mandat Comments
ory
X-Request-Id Unique id for each API request String yes
X-Merchant-Client-Id Client id for authentication String yes
X-Merchant-Client-Secret Secret key for authentication String yes
cred_app_present If CRED app is present in user device Boolean yes Possible values: “true” | ”false”
agent.platform User’s current platform Enum yes Possible values: “app” | “web” | “unknown“
agent.os User’s current OS Enum yes Possible values: “android” | “iOS” | “windows” |
“linux " | “macOS“ | “unknown“
agent.device User’s current device Enum yes Possible values: "mobile” | “iPAD” | “desktop” |
“tablet" | “unknown“
user.country_code User’s country code Enum no* Possible values: “+91”
user.phone_number User’s phone number String no*
user.user_id User’s CRED user id String no*
merchant All data related to merchant/partner JSON yes
offer_details.offers_applied If offer was applied on merchant side Boolean no Possible values: “true” | ”false”. Default value:
or not “false
(this is to handle double discounting)
merchant.order_id Merchant payment id/ Partner String yes
payment id
amount.currency Currency for the given amount Enum yes Possible values: “INR”
amount.value Amount value Double yes
redirect_url URL to which app will be redirected String no
during intent flow
metadata Any extra information related to JSON yes
request/order/user
metadata.session_id Session id used by merchant String yes
tracking_id Unique id to track payment/refund String yes Unique identifier for end-to-end order
Refund id in case of refunds
reference_id CRED reference id for payment String yes
state Payment state Enum yes Possible values: “CREATED” | “BLOCKED” |
“PROCESSING” | “FAILED” | “COMPLETED” |
“MANUAL_REVIEW”
checkout_mode Whether partner/merchant should Enum yes Possible values: “INTENT” | “COLLECT” |
call intent or wait for collect “WEB“
intent_url URL in case partner/merchant should String no This field should be consumed only when
fire intent checkout_mode is “INTENT”
web_url URL in case partner/merchant should String no This field should be consumed only when
fire web URL checkout_mode is “WEB”
status HTTP status code HTTP status code yes Will be 401 if authorization fails; 200 in all other
cases
error_code One of the pre-decided error code in Enum no Value format: “H-001”, “H-002”, and so on
case of error in request
eligibility If user eligibility has to be checked Boolean no Query parameter (At least 1 of eligibility,
order_creation and trigger_flow has to
be true)
order_creation If order creation has to be done Boolean no Query parameter (At least 1 of eligibility,
order_creation and trigger_flow has to
be true)
trigger_flow If flow(intent/collect) has to be Boolean no Query parameter (At least 1 of eligibility,
triggered order_creation and trigger_flow has to
be true)
persist_eligibility If eligibility check output should be Boolean no Applicable only for flows where the three steps
persisted for later steps by the same are not done in a single call. true by default.
tracking id Use false if subsequent request will do a
fresh eligibility check with new tracking id.
* If cred_app_present is false, either phone number or user_id is required in the request body
User Eligibility and Order Creation API
Endpoint with flags for each flows
POST https://app-stg.dreamplug.in/heimdall/public/v2/partner/checkout?
eligibility=true&order_creation=true&trigger_flow=true&persist_eligibili
ty=true
Endpoint to trigger all flows at once
POST https://app-stg.dreamplug.in/heimdall/public/v2/partner/checkout
/flows/all
Headers
X-Request-Id
X-Merchant-Client-Id
X-Merchant-Client-Secret
Request body
{
"tracking_id": "Same across all APIs",
"cred_app_present": true,
"agent": {
"platform": "app/web",
"os": "android/iOS/windows/linux/macOS",
"device": "mobile/iPAD/desktop/tablet"
},
"user": {
"country_code": "+91",
"phone_number": "9999999999",
"user_id": "<CRED_USER_ID>"
},
"merchant": {
"offer_details": {
"offers_applied": false
},
"order_id": "<MERCHANT_ORDER_ID/PARTNER_PAYMENT_ID>",
"amount": {
"currency": "INR",
"value": 100
}
},
"redirect_url": "<MERCHANT_REDIRECT_URL>",
"metadata": {
"session_id": "<MERCHANT_SESSION_ID>"
}
}
Field name API call context Comments
tracking_id ELIGIBILITY ORDER CREATION Same across all APIs
TRIGGER
cred_app_present ELIGIBILITY TRIGGER
agent ELIGIBILITY
user ELIGIBILITY
merchant ORDER CREATION
redirect_url TRIGGER
metadata ELIGIBILITY ORDER CREATION
X-Request-Id ELIGIBILITY ORDER CREATION Header; UUID used for debugging purpose
TRIGGER
X-Merchant-Client-Id ELIGIBILITY ORDER CREATION Header; used for authentication
TRIGGER
X-Merchant-Client-Secret ELIGIBILITY ORDER CREATION Header; used for authentication
TRIGGER
Response body
{
"response": {
"tracking_id": "<TRACKING_ID>",
"reference_id": "<CRED_REF_ID>",
"state": "ELIGIBLE/INELIGIBLE/ORDER_CREATED/FLOW_TRIGGERED",
"checkout_mode": "INTENT/COLLECT/WEB",
"intent_url": "<URL>",
"web_url": "<URL>",
"layout": {
"title": "Pay with CRED",
"sub_text": "pay seamlessly using your CRED coins. #killthebill",
"cta_text": "Pay with CRED",
"banner_text": "CRED offers you the most rewarding experience,
pay seamlessly using your CRED coins. #killthebill",
"icon": "https://d1sofudel0ufia.cloudfront.net/assets
/cred_brand_logo_bg_black.png"
}
},
"status": "OK"
}
Field name API call context Comments
tracking_id ELIGIBILITY ORDER CREATION
TRIGGER
layout ELIGIBILITY
reference_id ORDER CREATION TRIGGER
state ELIGIBILITY ORDER CREATION
TRIGGER
ELIGIBLE
INELIGIBLE
ORDER_CREATED
FLOW_TRIGGERED
checkout_mode TRIGGER
intent_url TRIGGER
web_url TRIGGER
Sample Responses
Scenario Status code Response body
Only eligibility flow 200 OK
(eligibility=true&order_creation=false&tri
gger_flow=false) {
"response": {
"tracking_id":
"59f6d784-f926-4196-93b1-
abde7a61cef5",
"state": "ELIGIBLE",
"layout": {
"title": "Pay with
CRED",
"sub_text": "pay
seamlessly using your CRED
coins. #killthebill",
"cta_text": "Pay with
CRED",
"banner_text": "CRED
offers you the most rewarding
experience, pay seamlessly
using your CRED coins.
#killthebill",
"icon":
"https://d1sofudel0ufia.
cloudfront.net/assets
/cred_brand_logo_bg_black.png"
}
},
"status": "OK"
}
Only order creation flow 200 OK
(eligibility=false&order_creation=true&tri
gger_flow=false) {
Note : Eligibility call has to be made
with same tracking id before making a "response": {
order_creation call "reference_id": "d74d2bb
3-5c01-48af-9785-565f7f7deb81",
"tracking_id": "0b5d8a3e
-f7dd-41ce-94d3-43ad64848789",
"state": "ORDER_CREATED"
},
"status": "OK"
}
Only trigger flow - intent 200 OK
(eligibility=false&order_creation=false&t
rigger_flow=true) {
Note : Eligibility call and order_creation
call has to be made with same tracking "response": {
id before making a trigger call "reference_id": "4972b54
7-603e-465f-a0ab-906acc5e2a65",
"tracking_id": "0b5d8a3e
-f7dd-41ce-94d3-43ad64848789",
"intent_url": "credpay:/
/checkout?ref_id=4972b547-603e-
465f-a0ab-
906acc5e2a65&is_collect=false&re
direct_to=soupchef://abcd.com",
"web_url": "",
"checkout_mode": "intent",
"state": "FLOW_TRIGGERED
"
},
"status": "OK"
}
Only trigger flow - collect 200 OK
(eligibility=false&order_creation=false&t
rigger_flow=true) {
Note : Eligibility call and order_creation
call has to be made with same tracking "response": {
id before making a trigger call "reference_id": "3436089
c-3d82-4078-87c2-0aef0c2776e8",
"tracking_id": "0b5d8a3e
-f7dd-41ce-94d3-43ad64848789",
"checkout_mode": "collec
t",
"state": "FLOW_TRIGGERED
"
},
"status": "OK"
}
User not eligible for CRED checkout 200 OK
User state will be INELIGIBLE until
{
web product is launched, and CRED
Pay should be disabled. "response": {
"reference_id":
After web product, the state will be ELI
GIBLE with web url present "3e545e5f-70be-42b2-993c-
23145b84882d",
"tracking_id":
"59f6d784-f926-4196-93b1-
abde7a61cef5",
"state": "ELIGIBLE
/INELIGIBLE",
"layout": {
"title": "Pay with
CRED",
"sub_text": "pay
seamlessly using your CRED
coins. #killthebill",
"cta_text": "Pay with
CRED",
"banner_text": "CRED
offers you the most rewarding
experience, pay seamlessly
using your CRED coins.
#killthebill",
"icon":
"https://d1sofudel0ufia.
cloudfront.net/assets
/cred_brand_logo_bg_black.png"
}
},
"status": "OK"
}
Request validation failures 200 OK
{
"status": "BAD_REQUEST",
"error_code": "HD_0009",
"error_message": "Something
went wrong. Please try again in
sometime."
}
Request quota exceeded 429 TOO MANY
(All /checkout endpoints share a REQUESTS
common request quota) {
"status":
"TOO_MANY_REQUESTS",
"error_code": "HD_0013",
"error_message": "Request
quota exceeded, try again in
some time.",
"error_description":
"Request quota exceeded, try
again in some time."
}
Refund API
Endpoint
POST https://app-stg.dreamplug.in/heimdall/public/v2/partner/refund
Headers
X-Request-Id
X-Merchant-Client-Id
X-Merchant-Client-Secret
Request Body
{
"tracking_id": "<ORDER_TRACKING_ID>",
"refund_tracking_id": "<UNIQUE_TRACKING_ID_FOR_REFUND>",
"amount": {
"currency": "INR",
"value": 100
},
"reason": "User returned the item"
}
Response body
{
"response": {
"refund_tracking_id": "<REFUND_ID>",
"refund_reference_id": "<CRED_REF_ID>",
"state": "BLOCKED/CREATED",
"amount": {
"value": 100,
"currency": "INR"
},
"refund_modes": [
{
"amount": {
"currency": "OFFER",
"value": 90
}
},
{
"amount": {
"currency": "INR",
"value": 10
},
"gateway_reference_id": "<GATEWAY_REF_ID>"
}
]
},
"status": "OK"
}
Order status API
Endpoint
GET https://app-stg.dreamplug.in/heimdall/public/v2/partner/status
/<tracking_id>
Headers
X-Merchant-Client-Id
X-Merchant-Client-Secret
Request path
tracking_id
Response body
{
"response": {
"tracking_id": "<MERCHANT_ORDER_ID/PARTNER_PAYMENT_ID>",
"reference_id": "<CRED_REF_ID>",
"state": "<ORDER_STATE>",
"amount": {
"currency": "INR",
"value": 26
},
"user": {
"user_id": "<ENCRYPTED_USER_ID>"
},
"payment_modes": [
{
"amount": {
"currency": "INR",
"value": 1
}
},
{
"amount": {
"currency": "OFFER",
"value": 25
},
"funding_source": {
"merchant": 12.5,
"others": 12,5
}
}
],
"refunds": [
{
"tracking_id": "<REFUND_ID>",
"reference_id": "<CRED_REF_ID>",
"state": "<REFUND_STATE>",
"amount": {
"value": 20,
"currency": "INR"
},
"refund_modes": [
{
"amount": {
"currency": "INR",
"value": 1
},
"gateway_reference_id": "<GATEWAY_REF_ID>"
},
{
"amount": {
"currency": "OFFER",
"value": 19
}
}
]
}
]
},
"status": "OK"
}
Amount corresponding to OFFER would be equivalent amount in rupees and not actual number of coins.
Order state
ORDER_CREATED
FLOW_TRIGGERED
PROCESSING
COMPLETED
FAILED
Request quota exceeded
Status Code: 429 TOO MANY REQUESTS
{
"status": "TOO_MANY_REQUESTS",
"error_code": "HD_0013",
"error_message": "Request quota exceeded, try again in some time.",
"error_description": "Request quota exceeded, try again in some
time."
}
Order Status Webhook
Endpoint
To be provided by merchant
Headers
To be provided by merchant
Request Body
Same as response body of order status API
Multiple calls could be made to the webhook due to timeout or any other internal/external concurrent calls. Duplicate webhook calls for
same order should be handled at the merchant’s end