### GET /websites/sakurupiah_id_developers Source: https://sakurupiah.id/developers/api-dokumentasi Retrieves a list of available payment channels supported by Sakurupiah.id. This endpoint provides detailed information about each payment method, including codes, names, transaction limits, fees, logos, and settlement details. ```APIDOC ## GET /websites/sakurupiah_id_developers ### Description This endpoint retrieves a list of available payment channels and their details. It provides comprehensive information about each payment method, including transaction limits, fees, and settlement information. ### Method GET ### Endpoint /websites/sakurupiah_id_developers ### Parameters #### Query Parameters - **api_id** (String) - Required - The API ID obtained after successful merchant account registration. - **method** (String) - Required - Must be set to 'list' to request the channel list. ### Request Example ``` GET /websites/sakurupiah_id_developers?api_id=YOUR_API_ID&method=list ``` ### Response #### Success Response (200) - **status** (String) - The status code of the response (e.g., "200"). - **message** (String) - A message indicating the success of the operation (e.g., "success"). - **data** (Array) - An array of payment channel objects. - **kode** (String) - Unique code for the payment channel. - **nama** (String) - Name of the payment channel. - **minimal** (String) - Minimum transaction amount. - **maksimal** (String) - Maximum transaction amount. - **biaya** (String) - Transaction fee. - **percent** (String) - Indicates if the fee is a percentage ('Percent') or nominal. - **tipe** (String) - Type of payment integration (e.g., 'DIRECT', 'REDIRECT'). - **logo** (String) - URL of the payment channel's logo. - **status** (String) - Current status of the payment channel ('Aktif' or other). - **addition** (Object) - Additional details about the payment channel. - **tambahan_biaya** (String) - Additional fee amount. - **jenis** (String) - Type of additional fee ('Nominal'). - **default_expired** (String) - Default expiration time in hours. - **settlement** (String) - Settlement period (e.g., 'Settlement H+1'). - **guide** (Object) - Payment guide information. - **title** (String) - Title of the payment guide. - **payment_guide** (String) - Step-by-step instructions for payment. #### Response Example ```json { "status": "200", "message": "success", "data": [ { "kode": "QRIS", "nama": "QRIS", "minimal": "500", "maksimal": "2000000", "biaya": "0.7", "percent": "Percent", "tipe": "DIRECT", "logo": "https://sakurupiah.id/assets/img/payment/QRIS.png", "status": "Aktif", "addition": { "tambahan_biaya": "350", "jenis": "Nominal", "default_expired": "24", "settlement": "Settlement H+1" }, "guide": { "title": "Cara Melakukan Pembayaran QRIS", "payment_guide": "1.Buka aplikasi pembayaran yang mendukung pembayaran menggunakan QRIS.\n 2.Pilih fitur QRIS Bayar.\n 3.Pindai kode QR yang diberikan oleh Merchant.\n 4.Pastikan tagihan yang ditagihkan sesuai dengan invoice.\n 5.Klik tombol konfirmasi pembayaran.\n 6.Masukkan PIN untuk menyelesaikan pembayaran.\n 7.Setelah pembayaran berhasil, kamu akan dialihkan ke Halaman Hasil Pembayaran.\n 8.Pembayaran selesai." } } ] } ``` ``` -------------------------------- ### Sakurapiah.id Payment Initiation (Form Data) Source: https://sakurupiah.id/developers/api-dokumentasi This section details the form-data parameters required to initiate a payment transaction via the Sakurapiah.id API. It specifies which parameters are mandatory, optional, and conditionally required, along with their expected data types and descriptions. The 'method' parameter is crucial for selecting the payment channel, such as 'BCAVA' for BCA Virtual Account. ```text **Body** form-data form-data | Type | Value | Description ---|---|---|--- api_id | String | API ID | WAJIB | Api ID di dapatkan setelah user berhasil registrasi akun, dapat melihatnya di menu setting atau pengaturan akun merchant method | String | BCAVA | WAJIB | Kode channel pembayaran, sesuaikan dengan kode channel pembayaran yang anda butuhkan name | String | nama pembeli | OPSIONAL | Nama pelanggan atau pembeli email | String | emailpembeli@gmail.com | OPSIONAL | Alamat email pelanggan atau pembeli anda phone | int | 081332702880 | WAJIB | Nomor Handphone aktif pelanggan atau pembeli kode negara yang di izinkan adalah indonesia & malaysia. contoh: 08xxx | 62xxx | 60xxx amount | int | 50000 | WAJIB | Total harga pembelian produk anda merchant_fee | int | 1 | WAJIB | 1 jika beban fee yang menanggung merchant | 2 jika beban fee yang menanggung pelanggan atau pembeli , jika di kosong atau nilai false maka beban fee otomatis akan di tanggung merchant merchant_ref | String | d834Hd-dj83kdk-38479freH | WAJIB | Nomor invoice atau kode unik dari server anda nilai string. nomor invoice harus berbeda setiap kali membuat transaksi baru expired | int | 24 | OPSIONAL | Batas waktu pembayaran, Jika parameter ini tidak diisi atau false, maka akan menggunakan batas waktu default yakni 24 jam atau sesuai batas default masing-masing channel pembayaran dalam zona waktu ( Asia/Jakarta ). Contoh : * value 1 = 1 jam * value 12 = 12 jam * value 24 = 24 jam produk[] | Array | produk 1 | OPSIONAL BERSYARAT | Nama produk pembelian qty[] | Array | 2 | OPSIONAL BERSYARAT | Masing-Masing jumlah pembelian produk harga[] | Array | 55000 | OPSIONAL BERSYARAT | Harga satuan produk sesuai Masing-Masing nama produk size[] | Array | XXL | OPSIONAL BERSYARAT | Ukuran produk atau size bisa custom sesuai data produk, note[] | Array | Warna biru | OPSIONAL BERSYARAT | Catatan tambahan setiap item produk callback_url | String | https://domain.com/callback | WAJIB | URL panggilan balik memungkinkan anda mengelola status data transaksi ketika terjadi perubahan pada invoice. kami akan mengirimkan beberapa data transaksi yang dapat di kelola di server anda ke alamat url callback, cek Api callback untuk melihat data yang dikirim setiap panggilan balik atau callback return_url | String | https://domain.com/invoice | WAJIB | URL untuk mengalihkan pelanggan Anda kembali signature | String | - | WAJIB | Signature dibuat menggunakan hash HMAC-SHA256 yang dikunci dengan apikey ``` -------------------------------- ### POST /list-payment.php Source: https://sakurupiah.id/developers/api-dokumentasi This endpoint retrieves a list of all available payment channels, indicating whether they are currently active or inactive (offline). It requires authentication via Bearer Token and specific request parameters. ```APIDOC ## POST /list-payment.php ### Description This endpoint allows you to retrieve a list of all payment channels. It includes channels that are currently active and those that are inactive (offline). Authentication is required using a Bearer Token, and the request body must contain your `api_id` and the desired `method`. ### Method `POST` ### Endpoint - **Production:** `https://sakurupiah.id/api/list-payment.php` - **Sanbox:** `https://sakurupiah.id/api-sanbox/list-payment.php` ### Parameters #### Header Parameters - **Authorization** (string) - Required - `Bearer YOUR_API_KEY` #### Request Body - **api_id** (string) - Required - Your merchant API ID. - **method** (string) - Required - Set to `list` to retrieve payment channels. ### Request Example (cURL) ```php 'https://sakurupiah.id/api-sanbox/list-payment.php', CURLOPT_RETURNTRANSFER => true, CURLOPT_ENCODING => '', CURLOPT_MAXREDIRS => 10, CURLOPT_TIMEOUT => 0, CURLOPT_FOLLOWLOCATION => true, CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1, CURLOPT_CUSTOMREQUEST => 'POST', CURLOPT_POSTFIELDS => array('api_id' => 'SANBOX-90976113','method' => 'list'), CURLOPT_HTTPHEADER => array( 'Authorization: Bearer SANBOX-snuNYFCZ9q7KhDPpWSTv7243YRUCSrC' ), )); $response = curl_exec($curl); c_close($curl); echo $response; ?> ``` ### Response #### Success Response (200) - **status** (boolean) - Indicates if the request was successful. - **data** (array) - An array of payment channel objects. - **id** (integer) - The unique identifier for the payment channel. - **name** (string) - The name of the payment channel (e.g., "QRIS", "Gopay"). - **code** (string) - A short code representing the payment channel. - **image** (string) - URL to the payment channel's logo. - **status** (string) - "active" or "inactive". #### Response Example ```json { "status": true, "data": [ { "id": 1, "name": "QRIS", "code": "QRIS", "image": "https://sakurupiah.id/images/payment/qris.png", "status": "active" }, { "id": 2, "name": "Gopay", "code": "GOPAY", "image": "https://sakurupiah.id/images/payment/gopay.png", "status": "inactive" } ] } ``` ``` -------------------------------- ### POST /websites/sakurupiah_id_developers Source: https://sakurupiah.id/developers/api-dokumentasi This endpoint allows merchants to create new payment transactions using various payment channels. It supports detailed product information and configurable payment expiry. ```APIDOC ## POST /websites/sakurupiah_id_developers ### Description This endpoint allows merchants to create new payment transactions using various payment channels. It supports detailed product information and configurable payment expiry. ### Method POST ### Endpoint /websites/sakurupiah_id_developers ### Parameters #### Request Body - **api_id** (String) - WAJIB - Api ID obtained after successful merchant account registration. - **method** (String) - WAJIB - Payment channel code (e.g., 'BCAVA'). - **name** (String) - OPSIONAL - Customer or buyer name. - **email** (String) - OPSIONAL - Customer or buyer email address. - **phone** (int) - WAJIB - Active customer or buyer phone number (Indonesian or Malaysian country codes supported, e.g., 62xxx, 60xxx). - **amount** (int) - WAJIB - Total purchase amount. - **merchant_fee** (int) - WAJIB - Fee allocation (1 for merchant, 2 for customer, false/empty defaults to merchant). - **merchant_ref** (String) - WAJIB - Unique server-side invoice number or code. - **expired** (int) - OPSIONAL - Payment deadline in hours (defaults to 24 hours or channel default in Asia/Jakarta time). - **produk[]** (Array) - OPSIONAL BERSYARAT - Product name. - **qty[]** (Array) - OPSIONAL BERSYARAT - Quantity of each product purchased. - **harga[]** (Array) - OPSIONAL BERSYARAT - Unit price for each product. - **size[]** (Array) - OPSIONAL BERSYARAT - Product size or custom size. - **note[]** (Array) - OPSIONAL BERSYARAT - Additional notes for each product item. - **callback_url** (String) - WAJIB - Callback URL for transaction status updates. - **return_url** (String) - WAJIB - URL to redirect customers after the transaction. - **signature** (String) - WAJIB - HMAC-SHA256 signature generated with the API key. ### Request Example ```json { "api_id": "YOUR_API_ID", "method": "BCAVA", "name": "nama pembeli", "email": "emailpembeli@gmail.com", "phone": 6283191910986, "amount": 20000, "merchant_fee": 1, "merchant_ref": "d834Hd-dj83kdk-38479f877HFH3s", "expired": 24, "produk": ["produk 1", "produk 2"], "qty": [1, 6], "harga": [45000, 25000], "size": ["XL", "XXL"], "note": ["Baju warna biru", "Warna merah"], "callback_url": "https://domain.com/callback", "return_url": "https://domain.com/invoice", "signature": "YOUR_SIGNATURE" } ``` ### Response #### Success Response (200) - **status** (String) - Transaction status code. - **message** (String) - Status message indicating success. - **data** (Array) - Array of transaction details. - **via** (String) - Payment method used. - **payment_kode** (String) - Payment channel code. - **trx_id** (String) - Unique transaction ID. - **merchant_ref** (String) - Merchant's reference ID. - **nama** (String) - Buyer's name. - **email** (String) - Buyer's email. - **phone** (String) - Buyer's phone number. - **total** (Integer) - Total transaction amount. - **merchant_fee** (String) - Indicates who bears the merchant fee. - **fee** (Integer) - Transaction fee amount. - **amount_merchant** (Integer) - Amount after fees for the merchant. - **date** (String) - Transaction date. - **time** (String) - Transaction time. - **expired** (String) - Payment expiration date and time. - **payment_status** (String) - Current payment status (e.g., 'pending'). - **qr** (String) - QRIS payment code (if applicable). - **payment_no** (Integer) - Payment number. - **checkout_url** (String) - URL for checkout or payment. - **produk** (Array) - Array of product details. - **nama_produk** (String) - Product name. - **qty** (String) - Quantity of the product. - **harga** (Integer) - Price of the product. - **size** (String) - Size of the product. - **note** (String) - Additional notes for the product. #### Response Example ```json { "status": "200", "message": "success", "data": [ { "via": "BCA Virtual-Account", "payment_kode": "BCAVA", "trx_id": "SBXjZgi0srfY-D2qLe4Ohd-CKni124", "merchant_ref": "d834Hd-dj83kdk-38479f877HFH3s", "nama": "nama pembeli", "email": "emailpembeli@gmail.com", "phone": "6283191910986", "total": 20000, "merchant_fee": "Merchant", "fee": 0, "amount_merchant": 14500, "date": "2025-05-26", "time": "03:24:09", "expired": "2025-05-26 06:24:09", "payment_status": "pending", "qr": "string QRIS", "payment_no": 2116127211, "checkout_url": "https://invoice-sakurupiah.id=?kd930933==xxxxxx" } ], "produk": [ { "nama_produk": "produk 1", "qty": "1", "harga": 45000, "size": "XL", "note": "Baju warna biru" }, { "nama_produk": "produk 2", "qty": "6", "harga": 25000, "size": "XXL", "note": "Warna merah" } ] } ``` ``` -------------------------------- ### Riwayat Transaksi Source: https://sakurupiah.id/developers/api-dokumentasi This section is a placeholder for documentation related to retrieving transaction history. Specific endpoints and parameters are not detailed in the provided text. ```APIDOC ## Riwayat Transaksi ### Description This section is intended for documenting the API endpoint(s) used to retrieve transaction history. Please refer to specific API documentation for details on available parameters, request methods, and response formats. ``` -------------------------------- ### Check Transaction History using PHP Source: https://sakurupiah.id/developers/api-dokumentasi This PHP script demonstrates how to make a POST request to the Sakurupiah API to retrieve transaction history. It uses cURL to send various parameters like api_id, method, and optional filters such as payment_kode, status, and date ranges. The script returns the API response, which contains transaction data. ```php 'https://sakurupiah.id/api-sanbox/transaction.php', CURLOPT_RETURNTRANSFER => true, CURLOPT_ENCODING => '', CURLOPT_MAXREDIRS => 10, CURLOPT_TIMEOUT => 0, CURLOPT_FOLLOWLOCATION => true, CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1, CURLOPT_CUSTOMREQUEST => 'POST', CURLOPT_POSTFIELDS => array( 'api_id' => 'SANBOX-90976113', 'method' => 'transaction', 'mechant' => '1', 'payment_kode' => 'BCAVA', 'trx_id' => 'SBX59oUGlLWk-lfzYZUK7a-eVkwQNL320', 'merchant_ref' => 'd834Hd-dj83kdk-38479freHFH3', 'status' => 'pending', 'tanggal_awal' => '2025-05-05', 'tanggal_akhir' => '2025-05-09' ), CURLOPT_HTTPHEADER => array( 'Authorization: Bearer SANBOX-snuNYFCZ9q7KhDPpWSTv7243YRUCSrC' ), )); $response = curl_exec($curl); curl_close($curl); echo $response; ?> ``` -------------------------------- ### Callback Handling Source: https://sakurupiah.id/developers/api-dokumentasi This endpoint receives payment status updates from the Sakurapiah payment gateway. It's crucial for confirming transaction outcomes and updating your system accordingly. ```APIDOC ## POST /callback ### Description This endpoint handles callbacks from the Sakurapiah payment gateway to notify your system about the status of a transaction. It validates the incoming signature and processes the payment status updates. ### Method POST ### Endpoint URL callback yang diatur di halaman Merchant atau pada saat request transaksi ### Parameters #### Headers - **Content-Type** (string) - Required - `application/json` - **X-Callback-Signature** (string) - Required - Signature callback - **X-Callback-Event** (string) - Required - Event callback. Nilai: `payment_status` #### Request Body - **trx_id** (string) - Required - Nomor ID trx_id transaksi dari sistem SAKURUPIAH - **merchant_ref** (string) - Required - Nomor trx_id /invoice dari sistem merchant yang dikirim saat request transaksi - **status** (string) - Required - Status Transaksi: (`pending`, `berhasil`, `expired`) - **status_kode** (int) - Required - Status kode: `pending` => 0, `berhasil` => 1, `expired` => 2 ### Request Example ```json { "trx_id": "SBXFsYv6tlHl-Tm8faWdA5-Jj0jXfb785", "merchant_ref": "575yhh-7967686gD", "status": "berhasil", "status_kode": 1 } ``` ### Response #### Success Response (200) - **success** (boolean) - Indicates if the callback was processed successfully. - **message** (string) - A message indicating the payment status. #### Response Example ```json { "success": true, "message": "Payment status berhasil" } ``` #### Error Response - **success** (boolean) - Indicates if the callback processing failed. - **message** (string) - An error message describing the failure. #### Error Response Example ```json { "success": false, "message": "Invalid signature" } ``` ``` -------------------------------- ### Request Payment Channels via Sakurupiah API Source: https://sakurupiah.id/developers/api-dokumentasi This PHP code snippet shows how to request a list of available payment channels from the Sakurupiah API. It utilizes cURL to send a POST request to the API endpoint, including the 'api_id' and 'method' in the request body, and the 'Authorization' Bearer Token in the header for authentication. The response contains data on active and inactive payment channels. ```php 'https://sakurupiah.id/api-sanbox/list-payment.php', CURLOPT_RETURNTRANSFER => true, CURLOPT_ENCODING => '', CURLOPT_MAXREDIRS => 10, CURLOPT_TIMEOUT => 0, CURLOPT_FOLLOWLOCATION => true, CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1, CURLOPT_CUSTOMREQUEST => 'POST', CURLOPT_POSTFIELDS => array('api_id' => 'SANBOX-90976113','method' => 'list'), CURLOPT_HTTPHEADER => array( 'Authorization: Bearer SANBOX-snuNYFCZ9q7KhDPpWSTv7243YRUCSrC' ), )); $response = curl_exec($curl); curl_close($curl); echo $response; ?> ``` -------------------------------- ### PHP Callback Handler for SakuruPiah Source: https://sakurupiah.id/developers/api-dokumentasi This PHP script handles incoming callbacks from the SakuruPiah payment gateway. It validates the callback signature using the provided API key and processes the payment status. It checks for 'payment_status' events and handles successful, expired, and pending transactions by decoding the JSON payload and performing specific actions based on the status. ```php #Handle Callback false, 'message' => 'Invalid signature', ])); } try { $data = json_decode($json); if (JSON_ERROR_NONE !== json_last_error()) { exit(json_encode([ 'success' => false, 'message' => 'Invalid data send by payment gateway', ])); } // Hentikan proses jika callback event-nya bukan payment_status if ('payment_status' !== $_SERVER['HTTP_X_CALLBACK_EVENT']) { exit(json_encode([ 'success' => false, 'message' => 'Unrecognized callback event: ' . $_SERVER['HTTP_X_CALLBACK_EVENT'], ])); } // Mengambil data callback $payment_TrxID = $data->trx_id; $payment_MerchantRef = $data->merchant_ref; $payment_Status = $data->status; $payment_StatusKode = $data->status_kode; if ($data->status == "berhasil" and $payment_StatusKode == 1) { //Lakukan sesuatu jika transaksi berhasil contoh seperti updated status transaksi pada database anda dll exit(json_encode([ 'success' => true, 'message' => 'Payment status berhasil', ])); } else if (($data->status == "expired" and $payment_StatusKode == 2)) { //Lakukan sesuatu jika transaksi expired / kadaluarsa contoh seperti updated status transaksi pada database anda dll exit(json_encode([ 'success' => true, 'message' => 'Payment status expired', ])); } else if (($data->status == "pending" and $payment_StatusKode == 0)) { //Jika status pending mungkin ada beberapa aksi yang ingin di lakukan tambahkan disini atau abaikan jika tidak ada aksi ketika status tetap pending biarkan cukup respon json yang di simpan exit(json_encode([ 'success' => true, 'message' => 'Payment status pending', ])); } else { throw new Exception('Error Data Status Callback'); } } catch (Exception $e) { exit(json_encode(['success' => false, 'message' => $e->getMessage()])); } ?> ``` -------------------------------- ### Authorization Source: https://sakurupiah.id/developers/api-dokumentasi Sakurupiah API requires authentication using a Bearer Token in the Authorization header. This token, often referred to as an API Key, is essential for securing requests and granting access to resources. ```APIDOC ## Authorization ### Description Authentication is performed by including a `Bearer` token in the `Authorization` header. This token, your API Key, is required for all authenticated requests. ### Method All authenticated requests require the `Authorization` header. ### Endpoint N/A (Header parameter) ### Parameters #### Header Parameters - **Authorization** (string) - Required - `Bearer YOUR_API_KEY` ### Request Example ``` Authorization: Bearer SANBOX-snuNYFCZ9q7KhDPpWSTv7243YRUCSrC ``` ### Response N/A (Authentication is validated before response processing.) ``` -------------------------------- ### Check Merchant Balance using PHP Source: https://sakurupiah.id/developers/api-dokumentasi This snippet demonstrates how to check the total balance of a merchant account using the SakuraPiah API. It requires an Authorization Bearer Token and specific POST data including api_id and method. The response includes merchant name, total balance, and available balance. ```php 'https://sakurupiah.id/api-sanbox/check_balance.php', CURLOPT_RETURNTRANSFER => true, CURLOPT_ENCODING => '', CURLOPT_MAXREDIRS => 10, CURLOPT_TIMEOUT => 0, CURLOPT_FOLLOWLOCATION => true, CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1, CURLOPT_CUSTOMREQUEST => 'POST', CURLOPT_POSTFIELDS => array('api_id' => 'SANBOX-90976113','method' => 'balance'), CURLOPT_HTTPHEADER => array( 'Authorization: Bearer SANBOX-snuNYFCZ9q7KhDPpWSTv7243YRUCSrC' ), )); $response = curl_exec($curl); curl_close($curl); echo $response; ?> ``` -------------------------------- ### Create New Invoice using PHP Source: https://sakurupiah.id/developers/api-dokumentasi This snippet shows how to create a new transaction invoice using the SakuraPiah API. It requires an Authorization Bearer Token and a comprehensive set of POST data, including customer details, transaction amount, product information, and callback URLs. A signature is also required for authentication. ```php 'SANBOX-90976113', 'method' => 'BCAVA', 'name' => 'nama pembeli', 'email' => 'emailpembeli@gmail.com', 'phone' => '6283191910986', 'amount' => '20000', 'merchant_fee' => '1', 'merchant_ref' => 'd834Hd-dj83kdk-38479f877HFH3s', 'expired' => '24', 'produk' => ['produk 1', 'produk 2'], 'qty' => [1, 6], 'harga' => [45000, 25000], 'size' => ['XL', 'XXL'], 'note' => ['Baju warna biru', 'Warna merah'], 'callback_url' => 'https://domain.com/callback', 'return_url' => 'https://domain.com/invoice', 'signature' => '38bb508e14f206fbad92ef6007f3cfe126746bfb8f5ff272e738d85d7a56ddc5' //Contoh hasil signature ); $curl = curl_init(); curl_setopt_array($curl, array( CURLOPT_URL => 'https://sakurupiah.id/api-sanbox/create.php', CURLOPT_RETURNTRANSFER => true, CURLOPT_ENCODING => '', CURLOPT_MAXREDIRS => 10, CURLOPT_TIMEOUT => 0, CURLOPT_FOLLOWLOCATION => true, CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1, CURLOPT_CUSTOMREQUEST => 'POST', CURLOPT_POSTFIELDS => http_build_query($data), CURLOPT_HTTPHEADER => array( 'Authorization: Bearer SANBOX-snuNYFCZ9q7KhDPpWSTv7243YRUCSrC' ), )); $response = curl_exec($curl); curl_close($curl); echo $response; ?> ``` -------------------------------- ### Create Invoice API Source: https://sakurupiah.id/developers/api-dokumentasi Creates a new transaction invoice. Requires Bearer Token authentication and various details in the request body. ```APIDOC ## POST /api-sanbox/create.php ### Description Creates a new transaction invoice with Bearer Token authentication. Requires several input fields in the request body. ### Method POST ### Endpoint Production: `https://sakurupiah.id/api/create.php` Sanbox: `https://sakurupiah.id/api-sanbox/create.php` ### Parameters #### Request Body - **api_id** (String) - Required - Your unique API ID. - **method** (String) - Required - Set to 'BCAVA' for creating an invoice. - **name** (String) - Required - The name of the buyer. - **email** (String) - Required - The email address of the buyer. - **phone** (String) - Required - The phone number of the buyer (e.g., 6283191910986). - **amount** (String) - Required - The total transaction amount. - **merchant_fee** (String) - Required - The merchant's fee. - **merchant_ref** (String) - Required - A unique reference ID for the merchant. - **expired** (String) - Required - The expiration time for the invoice in hours (e.g., '24'). - **produk** (Array) - Optional - An array of product names. - **qty** (Array) - Optional - An array of quantities corresponding to the products. - **harga** (Array) - Optional - An array of prices corresponding to the products. - **size** (Array) - Optional - An array of sizes corresponding to the products. - **note** (Array) - Optional - An array of notes for each item. - **callback_url** (String) - Required - The URL to receive transaction callbacks. - **return_url** (String) - Required - The URL to redirect the user after the transaction. - **signature** (String) - Required - A signature generated based on transaction details (refer to signature generation documentation). ### Request Example ```json { "api_id": "SANBOX-90976113", "method": "BCAVA", "name": "nama pembeli", "email": "emailpembeli@gmail.com", "phone": "6283191910986", "amount": "20000", "merchant_fee": "1", "merchant_ref": "d834Hd-dj83kdk-38479f877HFH3s", "expired": "24", "produk": ["produk 1", "produk 2"], "qty": [1, 6], "harga": [45000, 25000], "size": ["XL", "XXL"], "note": ["Baju warna biru", "Warna merah"], "callback_url": "https://domain.com/callback", "return_url": "https://domain.com/invoice", "signature": "38bb508e14f206fbad92ef6007f3cfe126746bfb8f5ff272e738d85d7a56ddc5" } ``` ### Response (Response details for invoice creation would typically be provided here, including success and error scenarios. Please refer to the actual API response for specifics.) ``` -------------------------------- ### Generate HMAC-SHA256 Signature for Sakurupiah API Requests Source: https://sakurupiah.id/developers/api-dokumentasi This snippet demonstrates how to generate a signature for API requests using the HMAC-SHA256 algorithm. It requires the API ID, data method, merchant reference, amount, and your API key. The signature is crucial for ensuring data integrity and sender verification for transaction requests. ```php ``` -------------------------------- ### POST /api-sanbox/status-transaction.php Source: https://sakurupiah.id/developers/api-dokumentasi This endpoint allows you to check the status of a transaction. It returns the status of the transaction, which can be 'pending', 'berhasil' (successful), or 'expired'. ```APIDOC ## POST /api-sanbox/status-transaction.php ### Description This endpoint allows you to check the status of a transaction. It returns the status of the transaction, which can be 'pending', 'berhasil' (successful), or 'expired'. ### Method POST ### Endpoint https://sakurupiah.id/api-sanbox/status-transaction.php ### Parameters #### Request Body - **api_id** (String) - Required - API ID obtained after successful merchant account registration. - **method** (String) - Required - Must be set to 'status'. - **trx_id** (String) - Required - The transaction ID from the Sakurupiah system. ### Request Example ```json { "api_id": "SANBOX-90976113", "method": "status", "trx_id": "SBXFsYv6tlHl-Tm8faWdA5-Jj0jXfb785" } ``` ### Response #### Success Response (200) - **status** (String) - The HTTP status code of the response. - **message** (String) - A message indicating the success of the request. - **data** (Array) - An array containing transaction status details. - **status** (String) - The status of the transaction ('pending', 'berhasil', 'expired'). #### Response Example ```json { "status": "200", "message": "success", "data": [ { "status": "berhasil" } ] } ``` ``` -------------------------------- ### Check Balance API Source: https://sakurupiah.id/developers/api-dokumentasi Retrieves the total merchant balance using Bearer Token authentication. Requires api_id and method in the request body. ```APIDOC ## POST /api-sanbox/check_balance.php ### Description Retrieves the total merchant balance with Bearer Token authentication. Requires `api_id` and `method` in the request body. ### Method POST ### Endpoint Production: `https://sakurupiah.id/api/check_balance.php` Sanbox: `https://sakurupiah.id/api-sanbox/check_balance.php` ### Parameters #### Request Body - **api_id** (String) - Required - Your unique API ID obtained after registration. - **method** (String) - Required - Set to 'balance' to check the balance. ### Request Example ```json { "api_id": "SANBOX-90976113", "method": "balance" } ``` ### Response #### Success Response (200) - **status** (String) - Indicates the status of the request. - **message** (String) - A message describing the result of the request. - **data** (Object) - Contains merchant balance information: - **nama_merchant** (String) - The name of the merchant. - **balance** (String) - The current balance based on successful transactions in settlement. - **saldo_tersedia** (String) - The total available balance for the merchant. #### Response Example ```json { "status": "200", "message": "success", "data": { "nama_merchant": "SANBOX MERCHANT NAME", "balance": "50000", "saldo_tersedia": "1050000" } } ``` ``` -------------------------------- ### Sakurapiah.id Payment Response (200 OK) Source: https://sakurupiah.id/developers/api-dokumentasi This JSON object represents a successful payment response from the Sakurapiah.id API. It includes transaction details, customer information, payment status, and product information. The 'qr' field is specifically for QRIS payment codes. ```json { "status": "200", "message": "success", "data": [ { "via": "BCA Virtual-Account", "payment_kode": "BCAVA", "trx_id": "SBXjZgi0srfY-D2qLe4Ohd-CKni124", "merchant_ref": "d834Hd-dj83kdk-38479f877HFH3s", "nama": "nama pembeli", "email": "emailpembeli@gmail.com", "phone": "6283191910986", "total": 20000, "merchant_fee": "Merchant", "fee": 0, "amount_merchant": 14500, "date": "2025-05-26", "time": "03:24:09", "expired": "2025-05-26 06:24:09", "payment_status": "pending", "qr": "string QRIS", "payment_no": 2116127211, "checkout_url": "https://invoice-sakurupiah.id=?kd930933==xxxxxx" } ], "produk": [ { "nama_produk": "produk 1", "qty": "1", "harga": 45000, "size": "XL", "note": "Baju warna biru" }, { "nama_produk": "produk 2", "qty": "6", "harga": 25000, "size": "XXL", "note": "Warna merah" } ] } ``` -------------------------------- ### Signature Generation Source: https://sakurupiah.id/developers/api-dokumentasi A signature must be generated for transaction requests to ensure data integrity and sender verification. This is achieved using the HMAC-SHA256 hashing algorithm with specific parameters. ```APIDOC ## Signature Generation ### Description To ensure data integrity and sender verification for transaction requests, a signature must be generated using the HMAC-SHA256 algorithm. The signature is created by hashing a combination of your API ID, Data Method, Merchant Reference, Amount, and your API Key. ### Method HMAC-SHA256 hashing ### Parameters - **api_id** (string) - Required - Your merchant API ID. - **data_method** (string) - Required - The payment method (e.g., `QRIS`, `BCAVA`, `BRIVA`, `BNIVA`, `GOPAY`, `DANA`). - **merchant_ref** (string) - Required - A unique code for the transaction generated by the merchant. - **amount** (string) - Required - The total payment amount. - **apikey** (string) - Required - Your merchant API Key. ### Request Example (PHP) ```php ``` ### Response Example `Signature: 3e06435796cca95a6ff734e6d664a6d4cf06cca9d7c6cc3023622b3ab8e09840` ``` -------------------------------- ### Check Transaction Status with PHP cURL Source: https://sakurupiah.id/developers/api-dokumentasi This snippet demonstrates how to check the status of a transaction using PHP's cURL library. It sends a POST request to the SakuraPiah API with necessary authentication and transaction details. The response contains the transaction status. ```php 'https://sakurupiah.id/api-sanbox/status-transaction.php', CURLOPT_RETURNTRANSFER => true, CURLOPT_ENCODING => '', CURLOPT_MAXREDIRS => 10, CURLOPT_TIMEOUT => 0, CURLOPT_FOLLOWLOCATION => true, CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1, CURLOPT_CUSTOMREQUEST => 'POST', CURLOPT_POSTFIELDS => array('api_id' => 'SANBOX-90976113','method' => 'status','trx_id' => 'SBXFsYv6tlHl-Tm8faWdA5-Jj0jXfb785'), CURLOPT_HTTPHEADER => array( 'Authorization: Bearer SANBOX-snuNYFCZ9q7KhDPpWSTv7243YRUCSrC' ), )); $response = curl_exec($curl); curl_close($curl); echo $response; ?> ```