Skip to content

Latest commit

History

4 Commits

Folders and files

NameName
Last commit message
Last commit date

Repository files navigation

Winpay Code Samples

Sample code repository for integrating with the Winpay Payment Gateway API.
This repository provides examples in multiple programming languages to help developers quickly integrate payment features into their applications.

Supported Languages

  • PHP
  • NodeJS
  • Go
  • Java
  • Python
  • Ruby
  • C#
  • PowerShell
  • cURL

Repository Structure

Code-Samples
│
├── PHP
├── NodeJs
├── Go
├── Java
├── Python
├── Ruby
├── CSharp
├── PowerShell
├── cURL
└── README.md

Each folder contains sample requests for specific APIs.


Available Sample APIs

Checkout Page

APIFile
Create Checkout Pagecheckoutpage_create.*
Find Checkout by IDcheckoutpage_find.*
Find Checkout by Merchant Reference Numbercheckoutpage_find_by_merchant_reference_number.*
Update Checkout Pagecheckoutpage_update.*
Delete Checkout Pagecheckoutpage_delete.*

SNAP Virtual Account

APIFile
Create Virtual Accountsnap_virtual_account_create.*
Virtual Account Inquirysnap_virtual_account_inquiry.*

SNAP QRIS

APIFile
Generate QRISsnap_qris_generate.*
Query QRIS Statussnap_qris_query.*

SNAP E-Wallet

APIFile
Create Paymentsnap_e_wallet_payment_create.*
Payment Statussnap_e_wallet_payment_status.*
Cancel Paymentsnap_e_wallet_payment_cancel.*

SNAP Modern Retail

APIFile
Create Paymentsnap_modern_retail_payment_create.*
Payment Statussnap_modern_retail_payment_status.*

SNAP Credit Card

APIFile
Credit Card Paymentsnap_credit_card_payment.*

Example

Below is a sample request for creating a Virtual Account.

<?php$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => 'https://sandbox-snap.winpay.id/snap/v1.0/transfer-va/create-va',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_CUSTOMREQUEST => 'POST',
CURLOPT_POSTFIELDS =>'{ "customerNo": "000003212", "virtualAccountName": "Alisha Arunika", "trxId": "INV-000000023212x22", "totalAmount": { "value": "25000.00", "currency": "IDR" }, "virtualAccountTrxType": "c", "expiredDate": "2023-09-01T19:30:14+07:00", "additionalInfo": { "channel": "BRI" } }',
CURLOPT_HTTPHEADER => array(
'X-TIMESTAMP: timestamp',
'X-SIGNATURE: signature',
'X-PARTNER-ID: partnerId',
'X-EXTERNAL-ID: externalId',
'CHANNEL-ID: WEB',
'Content-Type: application/json'
),
));
$response = curl_exec($curl);
curl_close($curl);
echo$response;

Environment

Sandbox

https://sandbox-snap.winpay.id

Production

https://snap.winpay.id

Authentication

All SNAP APIs require the following headers:

HeaderDescription
X-TIMESTAMPRequest timestamp
X-SIGNATURERequest signature
X-PARTNER-IDPartner ID provided by Winpay
X-EXTERNAL-IDUnique external ID
CHANNEL-IDChannel identifier
Content-Typeapplication/json

Callback / Notification

Winpay will send asynchronous payment notifications to the callback URL configured for your merchant account.

Please ensure:

  • Callback URL is publicly accessible.
  • Verify callback signature before processing.
  • Handle duplicate notifications idempotently.
  • Return HTTP 200 response after successful processing.

Documentation

For complete API specifications, please refer to:


Getting Started

  1. Clone repository
git clone https://github.com/winpay-developer/Code-Samples.git
  1. Enter the desired language folder
cd PHP
  1. Modify:
  • Partner ID
  • Signature
  • Timestamp
  • Merchant Reference Number
  • Callback URL
  1. Execute the sample.

Winpay Developer

Payment Gateway Integration Made Simple.

About

Winpay integration code samples for programming languages ​​such as NodeJS, PHP, Golang, and so on

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages