Create Payment
The Create Payment API allows merchants to initiate a payment request. This process involves generating a payment ID that can be used to query the payment.
Endpoint
Request URL: https://apihit.net/api/payment/create
Request Headers
| Header Name | Value |
|---|---|
| Content-Type | "application/json" |
| Accept | "application/json" |
| X-Signature | The HMAC signature used for verification. |
Request Parameters
| Property | Presence | Type | Description |
|---|---|---|---|
| mode | Mandatory | String | "URL_REDIRECT" |
| mid | Mandatory | String | Provided by creedo during onboarding. |
| payment_method | Mandatory | String | This parameter indicates the method of payment. For IDR_VA, the value of this parameter should be "IDR_VA". |
| merchant_payment_id | Mandatory | String | Unique invoice number used on the merchant side for this specific payment. Max length is 25 characters. Special characters "<", ">" and "&" are not allowed. |
| payment_amount | Mandatory | Integer | Amount of the payment to be made. |
| payment_currency | Mandatory | String | Currency of the mentioned amount. For IDR_VA, the value of this parameter should be "IDR". |
| ipn_url | Mandatory | String | URL where creedo sends Instant Payment Notification. It must accept POST request from creedo. |
| success_url | Mandatory | String | Redirects to this URL after the user submits payment information. |
| failed_url | Mandatory | String | Redirects to this URL after the user cancel payment. |
| customer_id | Mandatory | String | Unique user ID on the merchant's side. |
| customer_name | Mandatory | String | Full name of the user on the merchant's side. |
| customer_phone_number | Mandatory | String | Registered phone number of the user on the merchant's side. |
| customer_email | Mandatory | String | Registered email address of the user on the merchant's side. |
| customer_ip | Mandatory | String | Current IP address of the user. |
| customer_type | Optional | String | Type of the user. Possible values: Trusted, FTD, MTD, YTD, Others. |
| btag | Optional | String | Btag identifier of the customer. |
| additional_info_1 | Optional | String | Additional information. |
| additional_info_2 | Optional | String | Additional information. |
Success Response Parameters
| Property | Type | Description |
|---|---|---|
| gateway_status | String | "accepted" |
| payment_url | String | Redirect user to payment page |
| creedo_payment_id | String | Creedo-generated payment ID for this payment creation request. This payment ID can be used later to track the payment and in other payment-related APIs. - A payment ID will expire after 1 hour. If a merchant tries to reuse a payment ID after 1 hour, they will receive an error. Additionally, the merchant will receive an expired callback after 1 hour. |
Error Response Parameters
| Property | Type | Description |
|---|---|---|
| gateway_status | String | "rejected" |
| message | String | Error message here. |
Signature Generation
The signature (X-Signature) is generated using HMAC with SHA-256. It uses the secret_key and a secret_string as inputs. All inputs should be in string format:
secret_string = mid:mode:merchant_payment_id:payment_method:payment_currency:payment_amount
Request Body
POST /api/payment/create HTTP/1.1
Host: https://apihit.net
Content-Type: application/json
Accept: application/json
X-Signature: <hash_str>
{
"mode": "URL_REDIRECT",
"mid": "Your Merchant Public Key Here",
"payment_method": "IDR_VA",
"merchant_payment_id": "hap54hzxq0u",
"payment_amount": 400,
"payment_currency": "IDR",
"ipn_url": "https://example.com/ipn-handler",
"success_url": "http://example.com/payment-status/successful",
"failed_url": "http://example.com/payment-status/failed",
"customer_id": "USER12345",
"customer_name": "John Doe",
"customer_phone_number": "+6281XXXXXXXX",
"customer_email": "johndoe@example.com",
"customer_ip": "192.168.1.1",
"customer_type": "Trusted", // Optional
"btag": "BTAG001", // Optional
"additional_info_1": "Loyal customer", // Optional
"additional_info_2": "" // Optional
}
Success Response
A successful response will return a JSON object containing:
{
"gateway_status": "accepted",
"creedo_payment_id": "3C8HL0MHX9",
"payment_url": "https://api.creedo.capital/pay/OTk5NTI5NzI1NTEz/"
}
Error Response
In case of an error, the API will return a JSON object with error details:
{
"gateway_status": "rejected",
"message": "Unknown error occurred."
}
Notes
- The
merchant_payment_idmust be unique for each transaction to prevent duplication. - The merchant does not choose the issuing bank. The customer picks one from the Supported Banks list on the Creedo payment page, and only the banks enabled for your account are shown there.
Supported Banks
A virtual account is issued by a single bank. These are the banks that can issue one.
| Bank Name |
|---|
| BANK RAKYAT INDONESIA (BRI) |
| BANK MANDIRI |
| BANK NEGARA INDONESIA (BNI) |
| PERMATA BANK |
| CIMB NIAGA |
| BANK SAHABAT SAMPOERNA (BSS) |