Card Payments
This page will help you get started with Package Status.
Overview
Create direct charges when customers transact directly with a connected account, often unaware of your platform’s existence. With direct charges:
- The payment appears as a charge on the connected account, not your platform’s account.
- The connected account’s balance increases with every charge.
- Your account balance increases with application fees from every charge.
This charge type is best suited for platforms providing software as a service. For example, Shopify provides tools for building online storefronts, and Thinkific enables educators to sell online courses.
Begin You start
- Sign up the Metaprise developer devhub platform to get your unique Client ID and API key.
- Obtain your access token by authenticating to Metaprise using your unique Client ID and API key. You will need the access token to make API calls.
- Set up webhooks to receive notifications on Payment events.
Create a Payment
Use create a payment API to create a direct charge.
Example request
curl --request POST \
--url https://www.sandbox-checkout.imerchant.online/gateway/payapi \
--header 'accept: application/json' \
--header 'content-type: application/x-www-form-urlencoded' \
--data bid=py_live_0I9fPdXQWhzZPurCVe8y2AHX \
--data out_trade_no=test_123456338 \
--data amount=999 \
--data currency=USD \
--data spbill_create_ip=192.168.1.59 \
--data [email protected] \
--data body=test_product \
--data 'card=Rlf5b/ObS91Z1KzT2fEz2Llv7m5RQyTyiJBLbLbvkfO0YloBKnAdvYunDxVfUs4TXVbbnMvoajS/Ako/bKCoheQUMpxt+3TgJMWaaS018ZKp2wLgo14sBq+hNMEg7j55KwDS3CEBlOVp8Mg3KnGIn0oD+UwxlQSrSWXg4pvkM22VY+TUXbH7WhbhFiBvluKWk2DmOASsm6yvr1FaFIcEwzRlf7yKLS6kpmFk7UPczzR+jzqEQFnoklAQoahH59H62DMWcpudy5aauSwzj7YC8+kHvgI53ADfKtmzMyycs7WD9nE/2nPCxcmVeSXC/HEBXFbHiP371819j6ozXbgpX1JmBshNRIGk+RcYFrVNxeo=' \
--data shipping=eyJmaXJzdF9uYW1lIjoiZHNnZXJnIiwibGFzdF9uYW1lIjoiZWVyZXJnZXIiLCJwaG9uZSI6IjEzNDYwMjU5OTI4IiwibGluZTEiOiJhZGRyZXNzX2xpbmUxICIsImxpbmUyIjoiYWRkcmVzc19saW5lMiIsImNpdHkiOiJuZXcgeW9yayIsInN0YXRlIjoibmV3IHlvcmsiLCJjb3VudHJ5X2NvZGUiOiJ1cyIsInBvc3RhbF9jb2RlIjoiMTAwMjIifQ== \
--data item=W3sibmFtZSI6InQtc2hpcnQiLCJkZXNjcmlwdGlvbiI6ImkgYW0gZGVzY3JpcHRpb24iLCJ1bml0X3ByaWNlIjoxMCwicXR5IjoyLCJpbWFnZXMiOnsiaW1hZ2VzMSI6Imh0dHBzOi8vYWUwMS5hbGljZG4uY29tL2tmL0hmNjg4ZmFlNWYzNWY0N2ZmYjEzMTQwNDEwZmMyZTgyY1UvTmV3LVN1bW1lci1MZXR0ZXItUHJpbnQtQ2FzdWFsLVdvbWVuLXMtVHdvLVBpZWNlLU91dGZpdHMtU2V0LVRyYWNrc3VpdC1TaGlydC1TZXh5LVRvcC1CaWtlci5qcGciLCJpbWFnZXMyIjoiaHR0cHM6Ly9hZTAxLmFsaWNkbi5jb20va2YvSDg4Yzg2NzZmZGU1YzQyMDQ5YmJhZDIyNTBiYmJlNDMzTy9OZXctU3VtbWVyLUxldHRlci1QcmludC1DYXN1YWwtV29tZW4tcy1Ud28tUGllY2UtT3V0Zml0cy1TZXQtVHJhY2tzdWl0LVNoaXJ0LVNleHktVG9wLUJpa2VyLmpwZyJ9LCJhdHRyaWJ1dGVzIjp7ImNvbG9yIjoiWWVsbG93Iiwic2l6ZSI6IlhYWFhYTCIsInR5cGUiOiIxIiwidGFjayI6IjY2In0sIkl0ZW1fZGV0YWlsX2xpbmsiOiJJdGVtX2RldGFpbF9saW5rIiwidXBjIjoidXBjIiwic2t1Ijoic2t1IiwiYnJhbmQiOiJicmFuZCJ9XQ== \
--data phone=18600000000 \
--data tax=100 \
--data shipping_charge=500 \
--data pay_source_site=www.iMerchant.com \
--data sign=B4E23E35216796249FDD204F212B737F
Example rsponse
{
"result": "success",
"bid": "py_live_0I9fPdXQWhzZPurCVe8y2AHX",
"out_trade_no": "test_123456333",
"currency": "USD",
"transaction_id": "39092021311169761620802577",
"amount": "999"
}
Refund
Use create a payment API to create a refund.
Example request
curl --request POST \
--url https://www.sandbox-checkout.imerchant.online/gateway/refund \
--header 'accept: application/json' \
--header 'content-type: application/x-www-form-urlencoded' \
--data amount=999 \
--data bid=py_live_0I9fPdXQWhzZPurCVe8y2AHX \
--data refund_mchid=test_123456337 \
--data transaction_id=36562021311169761620803404 \
--data sign=98DD29639D2EE571C2CE2EA358446E81
Example rsponse
{
"result": "success",
"transaction_id": "36562021311169761620803404",
"attch_id": "fcce672dde4812de76dd649c8cc7dec7",
"sign": "F2E896EB74737D6DED60F776710BDCCE"
}
Updated 2 months ago