Credit

There may be scenarios in which you need to transfer funds from your account directly to your customer, unrelated to a previous customer transaction. You can do this by invoking a Create Credit request, which credits your customer’s credit card for the amount you specify.

Bear in mind that a Create Credit request is not the same as a Refund. Refunds should be used in the case where you need to return a charged amount to the customer. A Credit request, in contrast, is not related to any previous customer transaction.

Let’s proceed to create a Credit. If you imported our Postman Collection, you can follow-along with the examples by invoking the requests in the Credit folder.

Step 1: Create the Payment

The first step is to invoke a Create Payment request, which represents the payment to your customer. Create the request like so:

    var request = new XMLHttpRequest();
    request.open('POST', 'https://api.paymentsos.com/payments');
    request.setRequestHeader('Content-Type', 'application/json');
    request.setRequestHeader('api-version', '1.3.0');
    request.setRequestHeader('x-payments-os-env', 'test');
    request.setRequestHeader('app-id', 'com.zooz.docapp');
    request.setRequestHeader('private-key', 'bede7ee5-eaaq-4c9a-bc1f-617ba28256ae');
    request.setRequestHeader('idempotency-key', 'cust-34532-trans-001356-p');
    var body = {
      'amount': 34800,
      'currency': 'EUR',
      'statement_soft_descriptor': 'Oil lamp'};
    request.send(JSON.stringify(body));
  
    curl --compressed -X POST \
      https://api.paymentsos.com/payments \
      -H 'Content-Type: application/json' \
      -H 'api-version: 1.3.0' \
      -H 'x-payments-os-env: test' \
      -H 'app-id: com.zooz.docapp' \
      -H 'private-key: bede7ee5-eaaq-4c9a-bc1f-617ba28256ae' \
      -H 'idempotency-key: cust-34532-trans-001356-p' \
      -d '{
      "amount": 31602077,
      "currency": "EUR",
      "statement_soft_descriptor": "Oil lamp"
      }'
  

Step 2: Invoke the Create Credit Request

The next step is to credit your customer using the Create Credit API.

    var request = new XMLHttpRequest();
    request.open('POST', 'https://api.paymentsos.com/payments/{payment_id}/credits');
    request.setRequestHeader('Content-Type', 'application/json');
    request.setRequestHeader('api-version', '1.3.0');
    request.setRequestHeader('x-payments-os-env', 'test');
    request.setRequestHeader('app-id', 'com.zooz.docapp');
    request.setRequestHeader('private-key', 'bede7ee5-eaaq-4c9a-bc1f-617ba28256ae');
    request.setRequestHeader('idempotency-key', 'cust-34532-trans-001356-a');
    var body = {
      'payment_method': {
        'type': 'tokenized',
        'token': '9640e09b-85d0-4509-a19c-90aa65eb386a',
        'credit_card_cvv': '1231'},
      'reconciliation_id': '23434534534'};
    request.send(JSON.stringify(body));
  
    curl --compressed -X POST \
      https://api.paymentsos.com/payments/{payment_id}/credits \
      -H 'Content-Type: application/json' \
      -H 'api-version: 1.3.0' \
      -H 'x-payments-os-env: test' \
      -H 'app-id: com.zooz.docapp' \
      -H 'private-key: bede7ee5-eaaq-4c9a-bc1f-617ba28256ae' \
      -H 'idempotency-key: cust-34532-trans-001356-p' \
      -d '{
      "payment_method": {
        "type": "tokenized",
        "token": "9640e09b-85d0-4509-a19c-90aa65eb386a",
        "credit_card_cvv": "1231"
      },
      "reconciliation_id": "23434534534"
    }'
  
Last modified January 4, 2022