Alfamart

Using Over the Counter payment feature provided by Alfamart, the customer can perform online shopping and complete the payment at various stores under Alfa group. The supported stores are: Alfamart, Alfamidi, and DAN+DAN. Midtrans will send a real-time notification to you for every incoming payment.

The steps to integrate with Alfamart stores are given below.

  1. Send the charge API request to Midtrans with the selected acquirer.
  2. Display the payment code to customers.
  3. Handle notifications.

Send a Charge API request with payment details, transaction details, convenience store details, customer details, and item details. Successful response returns status_code:201.

By default, default expiry time for Alfamart is 24 hours unless specified by merchant (min 20s, max 180 days).




Alfamart Charge API Request


{
  "payment_type": "cstore",
  "transaction_details": {
    "gross_amount": 162500,
    "order_id": "order05"
  },
  "cstore": {
    "store": "alfamart",
    "alfamart_free_text_1": "Thanks for shopping with us!,",
    "alfamart_free_text_2": "Like us on our Facebook page,",
    "alfamart_free_text_3": "and get 10% discount on your next purchase."
  },
  "customer_details": {
    "first_name": "Budi",
    "last_name": "Utomo",
    "email": "[email protected]",
    "phone": "0811223344"
  },
  "item_details": [
    {
      "id": "id1",
      "price": 162500,
      "quantity": 1,
      "name": "tiket2"
    }
  ]
}
JSON AttributeDescriptionType
payment_typeThe payment method used by the customer. Value: cstore.String
transaction_detailsThe details of the specific transaction such as order_id and gross_amount.Object
cstoreDetails of the convenience store.Object
customer_detailsDetails of the customer.Object
item_detailsDetails of the item(s) purchased by the customer.Object



Alfamart Charge Response and Notifications


{
    "status_code": "201",
    "status_message": "Success, cstore transaction is successful",
    "transaction_id": "f1d381f8-7519-4139-b28f-81c6b3dc38ea",
    "order_id": "order05",
    "gross_amount": "10500.00",
    "payment_type": "cstore",
    "transaction_time": "2016-06-28 16:22:49",
    "transaction_status": "pending",
    "fraud_status": "accept",
    "payment_code": "010811223344",
    "store": "alfamart"
}
{
  "status_code": "201",
  "status_message": "midtrans payment notification",
  "transaction_id": "e3f0b1b5-1941-4ffb-9083-4ee5a96d878a",
  "order_id": "order04",
  "gross_amount": "162500.00",
  "payment_type": "cstore",
  "transaction_time": "2016-06-19 17:18:07",
  "transaction_status": "pending",
  "signature_key": "2d488c1ff0adc2396ee9b9765807b6d53182a0aa17cd9bb251b99879099d4f727903a75440b1814539f565774f7a80de0a7336c81d2071b4d3efe92f15400e41",
  "payment_code": "25709650945026",
  "store": "alfamart"
}
{
  "status_code": "200",
  "status_message": "midtrans payment notification",
  "transaction_id": "991af93c-1049-4973-b38f-d6052c72e367",
  "order_id": "order04",
  "gross_amount": "162500.00",
  "payment_type": "cstore",
  "transaction_time": "2016-06-20 11:44:07",
  "transaction_status": "settlement",
  "approval_code": "59061607081045705101",
  "signature_key": "a198f93ac43cf98171dcb4bd0323c7e3afbee77a162a09e2381f0a218c761a4ef0254d7650602971735c486fea2e8e9c6d41ee65d6a53d65a12fb1c824e86f9f",
  "payment_code": "25709650945026",
  "store": "alfamart"
}
{
  "status_code": "202",
  "status_message": "midtrans payment notification",
  "transaction_id": "fd70880f-3458-4b16-9f09-289924185977",
  "order_id": "order04",
  "gross_amount": "162500.00",
  "payment_type": "cstore",
  "transaction_time": "2016-06-20 17:18:08",
  "transaction_status": "expire",
  "signature_key": "c260504a448018b4c4831b381f8a8c5088c37f2706dcc60b4d7d99a16e0ae3c22bc8945cb5177742386bab1ddb12e7c175e1f57686b488e215406fa40fc75481",
  "payment_code": "25709650945026",
  "store": "alfamart"
}
JSON AttributeDescriptionType
status_codeStatus code of transaction charge result.String
status_messageMessage describing the status of the result of API request.String
transaction_idTransaction ID given by Midtrans.String
order_idOrder ID specified by merchant.String
gross_amountTotal amount of transaction in IDR.String
payment_typeThe payment method used by the customer. Value: cstore.String
transaction_timeTimestamp of transaction in ISO 8601 format. Time Zone (GMT+7).String
transaction_statusTransaction status of Indomaret transaction. Possible values are pending, settlement, and expire.String
fraud_statusDetection result by Fraud Detection System (FDS). Possible values are
accept : Approved by FDS.
challenge: Questioned by FDS.
Note: Approve transaction to accept it or transaction will auto cancel during settlement.
deny: Denied by FDS. Transaction automatically failed.
String
payment_codeUnique payment code for customer to complete the payment in Alfamart.String
storeConvenience store identifier.String
signature_keySpecial string to verify the integrity of the response. For more details refer Verifying Notification Authenticity.String

📘

Note

Possible error codes are 400, 401, 402, 406, 410