Chilkat Online Tools

unicodeCpp / Razorpay APIs / Transfer Reversals

Back to Collection Items

#include <CkHttpW.h>
#include <CkJsonObjectW.h>
#include <CkHttpResponseW.h>

void ChilkatSample(void)
    {
    // This example assumes the Chilkat API to have been previously unlocked.
    // See Global Unlock Sample for sample code.

    CkHttpW http;
    bool success;

    http.put_BasicAuth(true);
    http.put_Login(L"username");
    http.put_Password(L"password");

    // Use this online tool to generate code from sample JSON: Generate Code to Create JSON

    // The following JSON is sent in the request body.

    // {
    //   "amount": 100
    // }

    CkJsonObjectW json;
    json.UpdateInt(L"amount",100);

    http.SetRequestHeader(L"content-type",L"application/json");

    CkHttpResponseW *resp = http.PostJson3(L"https://api.razorpay.com/v1/transfers/{trf_id}/reversals",L"application/json",json);
    if (http.get_LastMethodSuccess() == false) {
        wprintf(L"%s\n",http.lastErrorText());
        return;
    }

    wprintf(L"%d\n",resp->get_StatusCode());
    wprintf(L"%s\n",resp->bodyStr());
    delete resp;
    }

Curl Command

curl -X POST
	-u 'username:password'
	-H "content-type: application/json"
	-d '{
	"amount": 100
}'
https://api.razorpay.com/v1/transfers/{trf_id}/reversals

Postman Collection Item JSON

{
  "name": "Transfer Reversals",
  "request": {
    "method": "POST",
    "header": [
      {
        "key": "content-type",
        "value": "application/json"
      }
    ],
    "body": {
      "mode": "raw",
      "raw": "{\n\t\"amount\": 100\n}"
    },
    "url": {
      "raw": "https://api.razorpay.com/v1/transfers/{trf_id}/reversals",
      "protocol": "https",
      "host": [
        "api",
        "razorpay",
        "com"
      ],
      "path": [
        "v1",
        "transfers",
        "{trf_id}",
        "reversals"
      ]
    }
  },
  "response": [
  ]
}