### PHP Example for Hash Key Generation Source: https://apidocs.sipay.com.tr/index This PHP code snippet demonstrates how to generate the hash key required for the Sipay API. It outlines the algorithm and provides a practical example for ensuring transaction security and integrity. ```PHP // Placeholder for PHP hash key generation code // Refer to the provided documentation link for the specific algorithm. ``` -------------------------------- ### PHP Request Sample for Sipay Payment Source: https://apidocs.sipay.com.tr/index Example of how to make a POST request to the Sipay API using PHP to process a payment. This snippet demonstrates setting up cURL options for the request. ```php 'https://app.sipay.com.tr/ccpayment/api/paySmart2D', 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 => json_encode([ "cc_holder_name" => "John Dao", "cc_no" => "4508034508034509", "expiry_month" => 12, "expiry_year" => 2026, "cvv" => 543, "currency_code" => "TRY", "installments_number" => 1, "invoice_id" => 5874544, "invoice_description" => "5974544 Ödemesi", "name" => "John", "surname" => "Dao", "total" => 458, "merchant_key" => "$2y$10$HmRgYosneqcwHj.UH7upGuyCZqpQ1ITgSMj9Vvxn.t6f.Vdf2SQFO", "items" => "[\n {\"name\":\"pr001\",\"price\":\"2.30\",\"quantity\":1,\"description\":\"pr001\"},\n {\"name\":\"pr001\",\"price\":\"2.70\",\"quantity\":1,\"description\":\"pr001\"},\n {\"name\":\"pr001\",\"price\":\"5.00\",\"quantity\":2,\"description\":\"pr001\"}\n]\n", "cancel_url" => "string", "return_url" => "string", "is_commission_from_user" => 1, "commission_by" => "merchant", "hash_key" => "string", "bill_address1" => "string", "bill_address2" => "string", "bill_city" => "string", "bill_postcode" => "string", "bill_state" => "string", "bill_country" => "string", "bill_email" => "string", "bill_phone" => "string", "card_program" => "string", "ip" => "string", "transaction_type" => "string", "vpos_type" => "Yalnızca Sigorta Üye işyeri tarafından bir sigorta ödemesi başlatmak için geçerlidir.", "identity_number" => "Yalnızca 'vpos_type':'insurance' olduğunda gönderilmelidir.", "metadata" => "string", "sale_web_hook_key" => "string", "Yinelenen Ödeme" => "Yinelenen Ödemeler için aşağıda ki parametreleri göndermeniz gerekmektedir,", "order_type" => 0, "recurring_payment_number" => 0, "recurring_payment_cycle" => "string", "recurring_payment_interval" => "string", "recurring_web_hook_key" => "string" ]), CURLOPT_HTTPHEADER => [ 'Content-Type: application/json' ], ]); $response = curl_exec($curl); $err = curl_error($curl); c$url = curl_init(); curl_setopt_array($curl, [ CURLOPT_URL => 'https://app.sipay.com.tr/ccpayment/api/paySmart2D', 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 => json_encode([ "cc_holder_name" => "John Dao", "cc_no" => "4508034508034509", "expiry_month" => 12, "expiry_year" => 2026, "cvv" => 543, "currency_code" => "TRY", "installments_number" => 1, "invoice_id" => 5874544, "invoice_description" => "5974544 Ödemesi", "name" => "John", "surname" => "Dao", "total" => 458, "merchant_key" => "$2y$10$HmRgYosneqcwHj.UH7upGuyCZqpQ1ITgSMj9Vvxn.t6f.Vdf2SQFO", "items" => "[\n {\"name\":\"pr001\",\"price\":\"2.30\",\"quantity\":1,\"description\":\"pr001\"},\n {\"name\":\"pr001\",\"price\":\"2.70\",\"quantity\":1,\"description\":\"pr001\"},\n {\"name\":\"pr001\",\"price\":\"5.00\",\"quantity\":2,\"description\":\"pr001\"}\n]\n", "cancel_url" => "string", "return_url" => "string", "is_commission_from_user" => 1, "commission_by" => "merchant", "hash_key" => "string", "bill_address1" => "string", "bill_address2" => "string", "bill_city" => "string", "bill_postcode" => "string", "bill_state" => "string", "bill_country" => "string", "bill_email" => "string", "bill_phone" => "string", "card_program" => "string", "ip" => "string", "transaction_type" => "string", "vpos_type" => "Yalnızca Sigorta Üye işyeri tarafından bir sigorta ödemesi başlatmak için geçerlidir.", "identity_number" => "Yalnızca 'vpos_type':'insurance' olduğunda gönderilmelidir.", "metadata" => "string", "sale_web_hook_key" => "string", "Yinelenen Ödeme" => "Yinelenen Ödemeler için aşağıda ki parametreleri göndermeniz gerekmektedir,", "order_type" => 0, "recurring_payment_number" => 0, "recurring_payment_cycle" => "string", "recurring_payment_interval" => "string", "recurring_web_hook_key" => "string" ]), CURLOPT_HTTPHEADER => [ 'Content-Type: application/json' ], ]); $response = curl_exec($curl); $err = curl_error($curl); c$url = curl_init(); curl_setopt_array($curl, [ CURLOPT_URL => 'https://app.sipay.com.tr/ccpayment/api/paySmart2D', 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 => json_encode([ "cc_holder_name" => "John Dao", "cc_no" => "4508034508034509", "expiry_month" => 12, "expiry_year" => 2026, "cvv" => 543, "currency_code" => "TRY", "installments_number" => 1, "invoice_id" => 5874544, "invoice_description" => "5974544 Ödemesi", "name" => "John", "surname" => "Dao", "total" => 458, "merchant_key" => "$2y$10$HmRgYosneqcwHj.UH7upGuyCZqpQ1ITgSMj9Vvxn.t6f.Vdf2SQFO", "items" => "[\n {\"name\":\"pr001\",\"price\":\"2.30\",\"quantity\":1,\"description\":\"pr001\"},\n {\"name\":\"pr001\",\"price\":\"2.70\",\"quantity\":1,\"description\":\"pr001\"},\n {\"name\":\"pr001\",\"price\":\"5.00\",\"quantity\":2,\"description\":\"pr001\"}\n]\n", "cancel_url" => "string", "return_url" => "string", "is_commission_from_user" => 1, "commission_by" => "merchant", "hash_key" => "string", "bill_address1" => "string", "bill_address2" => "string", "bill_city" => "string", "bill_postcode" => "string", "bill_state" => "string", "bill_country" => "string", "bill_email" => "string", "bill_phone" => "string", "card_program" => "string", "ip" => "string", "transaction_type" => "string", "vpos_type" => "Yalnızca Sigorta Üye işyeri tarafından bir sigorta ödemesi başlatmak için geçerlidir.", "identity_number" => "Yalnızca 'vpos_type':'insurance' olduğunda gönderilmelidir.", "metadata" => "string", "sale_web_hook_key" => "string", "Yinelenen Ödeme" => "Yinelenen Ödemeler için aşağıda ki parametreleri göndermeniz gerekmektedir,", "order_type" => 0, "recurring_payment_number" => 0, "recurring_payment_cycle" => "string", "recurring_payment_interval" => "string", "recurring_web_hook_key" => "string" ]), CURLOPT_HTTPHEADER => [ 'Content-Type: application/json' ], ]); $response = curl_exec($curl); $err = curl_error($curl); c$url = curl_init(); curl_setopt_array($curl, [ CURLOPT_URL => 'https://app.sipay.com.tr/ccpayment/api/paySmart2D', 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 => json_encode([ "cc_holder_name" => "John Dao", "cc_no" => "4508034508034509", "expiry_month" => 12, "expiry_year" => 2026, "cvv" => 543, "currency_code" => "TRY", "installments_number" => 1, "invoice_id" => 5874544, "invoice_description" => "5974544 Ödemesi", "name" => "John", "surname" => "Dao", "total" => 458, "merchant_key" => "$2y$10$HmRgYosneqcwHj.UH7upGuyCZqpQ1ITgSMj9Vvxn.t6f.Vdf2SQFO", "items" => "[\n {\"name\":\"pr001\",\"price\":\"2.30\",\"quantity\":1,\"description\":\"pr001\"},\n {\"name\":\"pr001\",\"price\":\"2.70\",\"quantity\":1,\"description\":\"pr001\"},\n {\"name\":\"pr001\",\"price\":\"5.00\",\"quantity\":2,\"description\":\"pr001\"}\n]\n", "cancel_url" => "string", "return_url" => "string", "is_commission_from_user" => 1, "commission_by" => "merchant", "hash_key" => "string", "bill_address1" => "string", "bill_address2" => "string", "bill_city" => "string", "bill_postcode" => "string", "bill_state" => "string", "bill_country" => "string", "bill_email" => "string", "bill_phone" => "string", "card_program" => "string", "ip" => "string", "transaction_type" => "string", "vpos_type" => "Yalnızca Sigorta Üye işyeri tarafından bir sigorta ödemesi başlatmak için geçerlidir.", "identity_number" => "Yalnızca 'vpos_type':'insurance' olduğunda gönderilmelidir.", "metadata" => "string", "sale_web_hook_key" => "string", "Yinelenen Ödeme" => "Yinelenen Ödemeler için aşağıda ki parametreleri göndermeniz gerekmektedir,", "order_type" => 0, "recurring_payment_number" => 0, "recurring_payment_cycle" => "string", "recurring_payment_interval" => "string", "recurring_web_hook_key" => "string" ]), CURLOPT_HTTPHEADER => [ 'Content-Type: application/json' ], ]); $response = curl_exec($curl); $err = curl_error($curl); c$url = curl_init(); curl_setopt_array($curl, [ CURLOPT_URL => 'https://app.sipay.com.tr/ccpayment/api/paySmart2D', 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 => json_encode([ "cc_holder_name" => "John Dao", "cc_no" => "4508034508034509", "expiry_month" => 12, "expiry_year" => 2026, "cvv" => 543, "currency_code" => "TRY", "installments_number" => 1, "invoice_id" => 5874544, "invoice_description" => "5974544 Ödemesi", "name" => "John", "surname" => "Dao", "total" => 458, "merchant_key" => "$2y$10$HmRgYosneqcwHj.UH7upGuyCZqpQ1ITgSMj9Vvxn.t6f.Vdf2SQFO", "items" => "[\n {\"name\":\"pr001\",\"price\":\"2.30\",\"quantity\":1,\"description\":\"pr001\"},\n {\"name\":\"pr001\",\"price\":\"2.70\",\"quantity\":1,\"description\":\"pr001\"},\n {\"name\":\"pr001\",\"price\":\"5.00\",\"quantity\":2,\"description\":\"pr001\"}\n]\n", "cancel_url" => "string", "return_url" => "string", "is_commission_from_user" => 1, "commission_by" => "merchant", "hash_key" => "string", "bill_address1" => "string", "bill_address2" => "string", "bill_city" => "string", "bill_postcode" => "string", "bill_state" => "string", "bill_country" => "string", "bill_email" => "string", "bill_phone" => "string", "card_program" => "string", "ip" => "string", "transaction_type" => "string", "vpos_type" => "Yalnızca Sigorta Üye işyeri tarafından bir sigorta ödemesi başlatmak için geçerlidir.", "identity_number" => "Yalnızca 'vpos_type':'insurance' olduğunda gönderilmelidir.", "metadata" => "string", "sale_web_hook_key" => "string", "Yinelenen Ödeme" => "Yinelenen Ödemeler için aşağıda ki parametreleri göndermeniz gerekmektedir,", "order_type" => 0, "recurring_payment_number" => 0, "recurring_payment_cycle" => "string", "recurring_payment_interval" => "string", "recurring_web_hook_key" => "string" ]), CURLOPT_HTTPHEADER => [ 'Content-Type: application/json' ], ]); $response = curl_exec($curl); $err = curl_error($curl); c$url = curl_init(); curl_setopt_array($curl, [ CURLOPT_URL => 'https://app.sipay.com.tr/ccpayment/api/paySmart2D', 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 => json_encode([ "cc_holder_name" => "John Dao", "cc_no" => "4508034508034509", "expiry_month" => 12, "expiry_year" => 2026, "cvv" => 543, "currency_code" => "TRY", "installments_number" => 1, "invoice_id" => 5874544, "invoice_description" => "5974544 Ödemesi", "name" => "John", "surname" => "Dao", "total" => 458, "merchant_key" => "$2y$10$HmRgYosneqcwHj.UH7upGuyCZqpQ1ITgSMj9Vvxn.t6f.Vdf2SQFO", "items" => "[\n {\"name\":\"pr001\",\"price\":\"2.30\",\"quantity\":1,\"description\":\"pr001\"},\n {\"name\":\"pr001\",\"price\":\"2.70\",\"quantity\":1,\"description\":\"pr001\"},\n {\"name\":\"pr001\",\"price\":\"5.00\",\"quantity\":2,\"description\":\"pr001\"}\n]\n", "cancel_url" => "string", "return_url" => "string", "is_commission_from_user" => 1, "commission_by" => "merchant", "hash_key" => "string", "bill_address1" => "string", "bill_address2" => "string", "bill_city" => "string", "bill_postcode" => "string", "bill_state" => "string", "bill_country" => "string", "bill_email" => "string", "bill_phone" => "string", "card_program" => "string", "ip" => "string", "transaction_type" => "string", "vpos_type" => "Yalnızca Sigorta Üye işyeri tarafından bir sigorta ödemesi başlatmak için geçerlidir.", "identity_number" => "Yalnızca 'vpos_type':'insurance' olduğunda gönderilmelidir.", "metadata" => "string", "sale_web_hook_key" => "string", "Yinelenen Ödeme" => "Yinelenen Ödemeler için aşağıda ki parametreleri göndermeniz gerekmektedir,", "order_type" => 0, "recurring_payment_number" => 0, "recurring_payment_cycle" => "string", "recurring_payment_interval" => "string", "recurring_web_hook_key" => "string" ]), CURLOPT_HTTPHEADER => [ 'Content-Type: application/json' ], ]); $response = curl_exec($curl); $err = curl_error($curl); if ($err) { echo "cURL Error #:". $err; } else { echo $response; } c$url = curl_init(); curl_setopt_array($curl, [ CURLOPT_URL => 'https://app.sipay.com.tr/ccpayment/api/paySmart2D', 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 => json_encode([ "cc_holder_name" => "John Dao", "cc_no" => "4508034508034509", "expiry_month" => 12, "expiry_year" => 2026, "cvv" => 543, "currency_code" => "TRY", "installments_number" => 1, "invoice_id" => 5874544, "invoice_description" => "5974544 Ödemesi", "name" => "John", "surname" => "Dao", "total" => 458, "merchant_key" => "$2y$10$HmRgYosneqcwHj.UH7upGuyCZqpQ1ITgSM ``` -------------------------------- ### Sipay Refund Request Sample Source: https://apidocs.sipay.com.tr/index Example JSON payload for initiating a refund for a processed transaction. It requires invoice details, amount, and merchant credentials. The `amount` can be empty for a full refund. ```json { "invoice_id": "Cs2Ghy621dsa42f1D2", "amount": 125, "app_id": "6d4a7e9374a76c15260fcc75e315b0b9", "app_secret": "b46a67571aa1e7ef5641dc3fa6f1712a", "merchant_key": "$2y$10$HmRgYosneqcwHj.UH7upGuyCZqpQ1ITgSMj9Vvxn.t6f.Vdf2SQFO", "hash_key": "661ebbf2acc9d8bc:cb27:47tnM4SnmuVWRq9YMaHo2npFjXr7Nfe04poc_ri3g_R1NylhHZcj0Zu3Eul", "refund_transaction_id": "", "refund_web_hook_key": "string" } ``` -------------------------------- ### Sipay Payment Response Sample Source: https://apidocs.sipay.com.tr/index Example JSON response for a Sipay payment. This indicates the transaction status, description, and order/invoice IDs. ```json { "status_code": 100, "status_description": "The transaction has been Approved", "transaction_status": "Completed", "order_id": 162435932934307, "invoice_id": 33491162435928 } ``` -------------------------------- ### Sipay Payment Request Sample Source: https://apidocs.sipay.com.tr/index Example JSON payload for a Sipay payment request. This includes invoice details, merchant information, and status. ```json { "invoice_id": "Cs2Ghy621dsa42f1D2", "merchant_key": "$2y$10$HmRgYosneqcwHj.UH7upGuyCZqpQ1ITgSMj9Vvxn.t6f.Vdf2SQFO", "status": 1, "hash_key": "661ebbf2acc9d8bc:cb27:47tnM4SnmuVWRq9YMaHo2npFjXr7Nfe04poc_ri3g_R1NylhHZcj0Zu3Eul", "total": 10.25 } ``` -------------------------------- ### PHP Hash Key Generation Example Source: https://apidocs.sipay.com.tr/index PHP code snippet demonstrating how to generate the `hash_key` for Sipay API requests. This is crucial for request integrity and security. ```php "Cs2Ghy621dsa42f1D2", "amount" => 125, // ... other relevant fields ... ]; $appSecret = "your_app_secret"; // From Sipay $hashKey = generateHashKey($requestData, $appSecret); echo "Generated Hash Key: " . $hashKey; ?> ``` -------------------------------- ### Sipay Refund Response Sample Source: https://apidocs.sipay.com.tr/index Example JSON response after a refund request. It confirms the refund status, order number, and invoice ID. ```json { "status_code": 100, "status_description": "Refund completed successfully", "order_no": 15925741639038, "invoice_id": 66955, "ref_no": "5454545dgdgd545545" } ``` -------------------------------- ### Payment Process Success Response Sample (JSON) Source: https://apidocs.sipay.com.tr/index Example of a successful payment process response from the Sipay API. It includes a status code, description, and detailed data about the transaction, such as order numbers, payment method, and hash key. ```json [ { "status_code": 100, "status_description": "Payment process successful", "data": { "sipay_status": 1, "order_no": "VP17349639333373384", "order_id": "VP17349639333373384", "invoice_id": "FAG0VLKTJPWH5NT-1734963933", "sipay_payment_method": 1, "credit_card_no": "540667****5403", "transaction_type": "Auth", "payment_status": 1, "payment_method": 1, "error_code": 100, "error": "", "auth_code": "P06931", "merchant_commission": 16, "user_commission": 0, "merchant_commission_percentage": 2, "merchant_commission_fixed": 0, "installment": 1, "amount": 800, "payment_reason_code": "", "payment_reason_code_detail": "", "hash_key": "760f789805633680:142c:j1SaI6u6t__hcZZmQqzpSpwcjx6zdUch3U__iSkgQOJAmaoRXwWZPOvQAgvh0bCtkQm6f7nqK__iX9mYt3ok4lXmg==", "original_bank_error_code": "", "original_bank_error_description": "" } } ] ``` -------------------------------- ### Sipay Payment Request Payload Example Source: https://apidocs.sipay.com.tr/index This JSON payload represents a sample request for a Sipay credit card payment. It includes customer details, payment information, itemized purchases, and security hashes. Ensure all fields are correctly populated according to the API specifications. ```json [ { "cc_holder_name": "John Doe", "cc_no": 4508034508034509, "cvv": "000", "expiry_month": 12, "expiry_year": 2026, "currency_code": "TRY", "installments_number": 1, "invoice_id": "1564887Test", "invoice_description": "INVOICE TEST DESCRIPTION", "name": "John", "surname": "Dao", "total": 210, "merchant_key": "$2y$10$w/ODdbTmfubcbUCUq/ia3OoJFMUmkM1UVNBiIQIuLfUlPmaLUT1he", "items": [ { "item_id": 1, "sub_merchant_id": "98950-90-7111155889", "name": "Item1", "price": 10, "sub_merchant_share": 8, "quantity": 1, "description": "Item1 Description" }, { "item_id": 2, "sub_merchant_id": "98950-89-7111157028", "name": "Item2", "price": 20, "sub_merchant_share": 16, "quantity": 1, "description": "Item2 Description" }, { "item_id": 3, "sub_merchant_id": "98950-88-7111133015", "name": "Item3", "price": 30, "sub_merchant_share": 24, "quantity": 3, "description": "Item3 Description" }, { "item_id": 4, "sub_merchant_id": "98950-90-7111155889", "name": "Item4", "price": 30, "sub_merchant_share": 24, "quantity": 3, "description": "Item4 Description" } ], "hash_key": "36a50210c8b2f19e:12514:ZOkRUTaBZRzxotsa3GoEP8YdACrveObLwFbf91t1LQyoct4t9mUvh82oU5Jf/ni0mXFuFHTBfxAiMHLnRyv1/o3qT5mQ8690UUbAk3AKiCU=", "cancel_url": "string", "return_url": "string", "bill_address1": "string", "bill_address2": "string", "bill_city": "string", "bill_postcode": "string", "bill_state": "string", "bill_country": "string", "bill_email": "string", "bill_phone": "string", "sale_web_hook_key": "string", "card_program": "string", "ip": "string" } ] ``` -------------------------------- ### Example Items Array for Sipay API (JSON) Source: https://apidocs.sipay.com.tr/index This JSON structure represents the 'items' field in the Sipay API request body. It's an array of objects, where each object details a product in the transaction, including its name, price, quantity, and description. ```json [ { "name": "pr001", "price": "2.30", "quantity": 1, "description": "pr001" }, { "name": "pr001", "price": "2.70", "quantity": 1, "description": "pr001" }, { "name": "pr001", "price": "5.00", "quantity": 2, "description": "pr001" } ] ``` -------------------------------- ### Get POS Installment Information API Response (Success) Source: https://apidocs.sipay.com.tr/index A successful response from the getPos API returns a status code of 100 with a success message. The data object contains details about the installment plan, including pos_id, campaign_id, payable_amount, currency, title, and specific fields for agricultural cards like maturity_period and payment_frequency. ```json [ { "status_code": 100, "status_description": "Successfull", "data": { "pos_id": 65, "campaign_id": 0, "allocation_id": 0, "installments_number": 1, "card_type": "CREDIT CARD", "card_program": "BONUS", "card_scheme": "visa", "is_commercial": "TRUE", "payable_amount": 248, "hash_key": "77190be0fea77b1b:c6cc:NBq3GfN2uqyoTw1ISUEXDWB90wpSdKLfRHt__f5v9A1", "amount_to_be_paid": 248, "currency_code": "TRY", "currency_id": 1, "title": "Single payment", "maturity_period": "1 // Bu alan yalnızca tarım kartları için döner", "payment_frequency": "1 // Bu alan yalnızca tarım kartları için döner" } } ] ``` -------------------------------- ### Get POS Installment Information API Request Source: https://apidocs.sipay.com.tr/index This API retrieves installment details, maturity period, and payment frequency based on the provided credit card information, amount, currency, and merchant key. Authorization is required using a Bearer token. The credit card number should be the first 6 digits for standard cards or the full number for agricultural cards. ```json { "credit_card": "534261", "amount": 248.5, "currency_code": "TRY", "merchant_key": "$2y$10$HmRgYosneqcwHj.UH7upGuyCZqpQ1ITgSMj9Vvxn.t6f.Vdf2SQFO", "commission_by": "merchant", "is_recurring": 0, "is_2d": 0 } ``` -------------------------------- ### Get Saved Cards Response Sample (JSON) Source: https://apidocs.sipay.com.tr/index An example of a successful response from the 'getCardTokens' API, returning an array of saved card details. Each object includes identifiers, masked card numbers, and associated customer information. ```json { "status_code": 100, "status_description": "Data fetched successfully", "data": [ { "id": 15931, "card_token": "76703408b5551bbe70246869a62e7934", "card_user_key": "cJ>_uWL@_fv<2ad9:tE@_:cmgupCqZ///lK5E9f93lckC8hKvk5/PWWWiP6I9iGcET2k7krYGqccvAUTeGC7sH", "card_number": "540667****5403", "merchant_id": 18309, "customer_number": "7181415-18309", "card_issuer_bank": "T. IS BANKASI A.S.", "customer_name": "omur aktas", "customer_email": "test@gmail.com", "customer_phone": "5555555555555", "bank_id": 62, "created_at": "2024-12-09T10:10:21.000000Z", "updated_at": "2024-12-09T10:10:21.000000Z" } ] } ``` -------------------------------- ### C# Sample for Sipay Card Token Payment API Source: https://apidocs.sipay.com.tr/index This C# code snippet demonstrates how to make a payment request to the Sipay Card Token API using `HttpClient`. It serializes the request data to JSON and sends it as a POST request. Ensure proper management of the `merchant_key` and `hash_key`. ```csharp using System; using System.Net.Http; using System.Text; using System.Threading.Tasks; using System.Collections.Generic; public class SipayPayment { public static async Task MakePaymentAsync() { var client = new HttpClient(); var url = "https://app.sipay.com.tr/ccpayment/api/payByCardToken"; var paymentRequest = new Dictionary { { "card_token", "your_card_token" }, { "customer_number", 12345 }, { "customer_email", "customer@example.com" }, { "customer_phone", "+1234567890" }, { "customer_name", "John Doe" }, { "currency_code", "USD" }, { "installments_number", 1 }, { "invoice_id", "INV-001" }, { "invoice_description", "Order #123" }, { "total", 50.00 }, { "merchant_key", "your_merchant_key" }, { "items", "Product A, Product B" }, { "cancel_url", "https://yourwebsite.com/cancel" }, { "return_url", "https://yourwebsite.com/return" }, { "hash_key", "your_generated_hash_key" }, // Optional fields can be added here { "bill_address1", "123 Main St" }, { "bill_city", "Anytown" }, { "bill_country", "US" }, { "bill_email", "customer@example.com" }, { "bill_phone", "+1234567890" } }; var jsonPayload = Newtonsoft.Json.JsonConvert.SerializeObject(paymentRequest); var content = new StringContent(jsonPayload, Encoding.UTF8, "application/json"); try { HttpResponseMessage response = await client.PostAsync(url, content); response.EnsureSuccessStatusCode(); // Throw an exception if the status code is not 2xx string responseBody = await response.Content.ReadAsStringAsync(); Console.WriteLine(responseBody); } catch (HttpRequestException e) { Console.WriteLine($"Request error: {e.Message}"); } } } ``` -------------------------------- ### POST /api/installments Source: https://apidocs.sipay.com.tr/index Retrieves available installment options for a given merchant key. This endpoint is used to fetch the number of installments a customer can choose from for their payment. ```APIDOC ## POST /api/installments ### Description Retrieves available installment options for a given merchant key. This endpoint is used to fetch the number of installments a customer can choose from for their payment. ### Method POST ### Endpoint `https://provisioning.sipay.com.tr/ccpayment/api/installments` (Test) `https://app.sipay.com.tr/ccpayment/api/installments` (Production) ### Parameters #### Request Body - **merchant_key** (string) - Required - The merchant's unique key. ### Request Example ```json { "merchant_key": "$2y$10$HmRgYosneqcwHj.UH7upGuyCZqpQ1ITgSMj9Vvxn.t6f.Vdf2SQFO" } ``` ### Response #### Success Response (200) - **status_code** (integer) - Indicates the status of the operation. 100 for success. - **message** (string) - A descriptive message about the result. 'Üye işyeri aktif taksit' indicates active installments for the merchant. - **installments** (array of integers) - A list of available installment numbers. #### Response Example ```json { "status_code": 100, "message": "Üye işyeri aktif taksit", "installments": [ 1, 2, 3 ] } ``` #### Error Response (400) - **status_code** (integer) - Indicates an error status. - **message** (string) - A message describing the error. 'Geçersiz Yanıt' indicates an invalid response. ``` -------------------------------- ### Ruby Sample for Sipay Card Token Payment API Source: https://apidocs.sipay.com.tr/index This Ruby script illustrates how to make a payment request to the Sipay Card Token API. It uses the `net/http` library to send a JSON payload containing all the necessary transaction details. Pay attention to correctly formatting the `merchant_key` and `hash_key`. ```ruby require 'net/http' require 'uri' require 'json' uri = URI.parse("https://app.sipay.com.tr/ccpayment/api/payByCardToken") request_data = { "card_token" => "your_card_token", "customer_number" => 12345, "customer_email" => "customer@example.com", "customer_phone" => "+1234567890", "customer_name" => "John Doe", "currency_code" => "USD", "installments_number" => 1, "invoice_id" => "INV-001", "invoice_description" => "Order #123", "total" => 50.00, "merchant_key" => "your_merchant_key", "items" => "Product A, Product B", "cancel_url" => "https://yourwebsite.com/cancel", "return_url" => "https://yourwebsite.com/return", "hash_key" => "your_generated_hash_key", # Optional fields can be added here "bill_address1" => "123 Main St", "bill_city" => "Anytown", "bill_country" => "US", "bill_email" => "customer@example.com", "bill_phone" => "+1234567890" } http = Net::HTTP.new(uri.host, uri.port) http.use_ssl = true request = Net::HTTP::Post.new(uri.request_uri) request.body = request_data.to_json request["Content-Type"] = "application/json" response = http.request(request) puts JSON.parse(response.body) ``` -------------------------------- ### Cashout Request Payload Example Source: https://apidocs.sipay.com.tr/index This is an example JSON payload for a cashout request. It includes details for multiple cashout operations within the 'cashout_data' array, each with unique identifiers, recipient information, amount, currency, and description. Note that 'unique_id', 'name_surname', 'iban', etc., should only be provided within the 'cashout_data' array. ```json { "merchant_key": "$2y$10$HmRgYosneqcwHj.UH7upGuyCZqpQ1ITgSMj9Vvxn.t6f.Vdf2SQFO", "hash_key": "5c4ba833474917d0:fd30:sHw__XC+wersHg4WfL14dNjoe6knYV6Di3Xj0hKy439POpEsmcnJ32jdWU9laeWI3", "cashout_type": 1, "cashout_data": [ [ { "unique_id": "6182458", "name_surname": "Eren Yokus", "iban": "TR150006247004881217621234", "amount": 10, "currency": "TRY", "id_tc_kn": "12345636268", "gsm_number": "901111137653", "description": "Test" } ], [ { "unique_id": "431282458", "name_surname": "Eren Yokus", "iban": "TR150006247004881217621234", "amount": 10, "currency": "TRY", "id_tc_kn": "12345636268", "gsm_number": "901111137653", "description": "Test" } ] ], "unique_id": "Bu parametre sadece cashout_data içerisinde gönderilmesi gerekmektedir", "name_surname": "Bu parametre sadece cashout_data içerisinde gönderilmesi gerekmektedir", "iban": "Bu parametre sadece cashout_data içerisinde gönderilmesi gerekmektedir", "name_of_bank": "Bu parametre sadece cashout_data içerisinde gönderilmesi gerekmektedir", "reverse_web_hook_key": "reverse", "amount": "Bu parametre sadece cashout_data içerisinde gönderilmesi gerekmektedir", "currency": "Bu parametre sadece cashout_data içerisinde gönderilmesi gerekmektedir", "id_tc_kn": "Bu parametre sadece cashout_data içerisinde gönderilmesi gerekmektedir", "gsm_number": "Bu parametre sadece cashout_data içerisinde gönderilmesi gerekmektedir", "description": "Bu parametre sadece cashout_data içerisinde gönderilmesi gerekmektedir" } ```