POST /batches/{id}/payments

This operation is used to add one or more Payments to user(s) for a specific Batch that was created using POST /batches.

Validation will occur on each Payment when adding payments to a Batch. A Payment must have at least a valid MSISDN and an amount to PAY. All validation must succeed before the list of payments is added to the Batch.

Multiple payments to the same MSISDN are accepted. These payments will appear as multiple payments in the user's statement.

Payments can be made to 6DOT50 and non-6DOT50 registered members:

  • Payments to non-members will be automatically sent a SMS once the batch is submitted for payment.

  • Payments to existing members, who have the app installed, will receive a push notification that they have received a payment.

If your Pay account has been enabled with referral capability, the fields referralAmount and referralMsisdn may be used, otherwise they will be ignored.

A Batch must be in DRAFT status to add any Payments to it.

Request

Ensure the bearer token is included in the Header of the POST operation:

Header
Mandatory
Description

Authorization

Yes

Parameter
Mandatory
Description

id

Yes

The Batch ID to add Payment(s) to

The operation accepts an array of Payments to add to the specified Batch:

{
  "clearExisting": true,
  "payments": [
    {
      "msisdn": "string",
      "amount": decimal,
      "firstname": "string",
      "lastname": "string",
      "externalId": "string",
      "referralAmount": decimal,
      "referralMsisdn": "string"
    }
  ]
}
Body Field
Mandatory
Description

clearExisting

Yes

Set ClearExisting to true if you would like to remove all Payments currently in the Batch and replace them with a new list of Payments.

payments

Yes

Payment

Body Field
Mandatory
Description

msisdn

Yes

The mobile number to pay, formatted in international dialing format. e.g. 27821231234.

amount

Yes

The Amount to transfer to the MSISDN (up to 2 decimal places).

firstname

No

First name of the person to pay (optional)

lastname

No

Last name of the person to pay (optional)

externalId

No

Optional payment identifier that can be supplied by external system for tracing purposes. If supplied, the external ID must be unique.

referralAmount

No

The Amount to allocate to a referral (optional)

referralMsisdn

No

Referral MSISDN to pay (international format, e.g. 27821231234)

The use of referralAmount and referralMsisdn requires your PAY account to be enabled at the Organisational level. Please contact Support for more information.

Response

If successful, the operation will return the following response, which includes the standard Batch response, a Summary for the Batch, as well as Payment(s) that were added to the Batch:

{
  "id": "string($guid)",
  "name": "string",
  "statusCode": "string",
  "externalId": "string",
  "createdAt": "string($date-time)",
  "summary": {
    "paymentsAmount": decimal,
    "paymentsCount": int32,
    "referralsAmount": decimal,
    "settledAmount": decimal,
    "settledCount": int32,
    "cancelledAmount": decimal,
    "cancelledCount": int32
  },
  "payments": [
    {
      "id": "string($guid)",
      "batchId": "string($guid)",
      "msisdn": "string",
      "amount": decimal,
      "firstname": "string",
      "lastname": "string",
      "externalId": "string",
      "statusCode": "string",
      "settledAt": "string($date-time)",
      "isMember": true,
      "referralAmount": decimal,
      "referralMsisdn": "string",
      "createdAt": "string($date-time)"
    }
  ]
}
Field
Response Type
Description

id

string($guid)

Batch ID.

name

string

Friendly name of the Batch.

externalId

string

External ID of the Batch.

statusCode

string

Status of the Batch.

createdAt

string($date-time)

Date and time when the Batch was created.

summary

payments

BatchSummary

Field
Response Type
Description

paymentsAmount

decimal

Total value of payments to be made

paymentsCount

int32

Total count of payments to be made

referralsAmount

decimal

Total value of referral payments to be made

settledAmount

decimal

Total value of payments that have been settled to users (i.e. paid to their accounts). The balance (paymentsAmount less settledAmount) is the value of payments pending to non-6DOT50 members (i.e. still to join)

settledCount

int32

Total count of payments settled

cancelledAmount

decimal

Total amount of payments cancelled in the batch (e.g. by using cancel operation)

cancelledCount

int32

Total count of payments cancelled

Payment

Field
Response Type
Description

id

string($guid)

Unique ID for the Payment. can be used to perform payment specific operations using /payments

batchId

string($guid)

The Batch ID that the Payment is part of.

msisdn

string

The mobile number that will be paid, formatted in international dialing format. e.g. 27821231234.

amount

decimal

The amount that will be paid for the Payment.

firstname

string

Firstname of the user.

lastname

string

Lastname of the user.

externalId

string

Payment identifier supplied by external system for tracing purposes.

statusCode

string

settledAt

string($date-time)

The date at which the Payment was paid into the user's account.

isMember

boolean

true = the user is a member of 6DOT50, false = the user is not a member of 6DOT50.

referralAmount

decimal

The Amount to allocate as a referral. Only applicable if Referral capability has been enabled for the Organisation.

referralMsisdn

string

The MSISDN of the referral. Only applicable if Referral capability has been enabled for the Organisation.

createdAt

string($date-time)

The date and time when the Payment instruction was created.

Sample Response
{
  "id": "b7ccbefd-51e1-4720-81fb-da5740e38e8c",
  "name": "Test Batch 1",
  "statusCode": "DRAFT",
  "externalId": "testbatch1",
  "createdAt": "2022-12-13T12:29:39.633",
  "summary": {
    "paymentsAmount": 23,
    "paymentsCount": 3,
    "referralsAmount": 0,
    "settledAmount": 0,
    "settledCount": 0,
    "cancelledAmount": 0,
    "cancelledCount": 0
  },
  "payments": [
    {
      "id": "cb6c2984-7b80-4964-aed7-6a12b72a7895",
      "msisdn": "27821231234",
      "amount": 10,
      "firstname": "Test",
      "lastname": "User 1",
      "statusCode": "DRAFT",
      "isMember": false
    },
    {
      "id": "4e47e31e-33e5-476e-bb9e-98bde753c207",
      "msisdn": "27821231235",
      "amount": 5,
      "firstname": "Test",
      "lastname": "User 2",
      "statusCode": "DRAFT",
      "isMember": false
    },
    {
      "id": "df5039d8-6d3e-4c64-a4e3-f5bdf12d8f1b",
      "msisdn": "27821231236",
      "amount": 8,
      "firstname": "Test",
      "lastname": "User 3",
      "statusCode": "DRAFT",
      "isMember": false
    }
  ]
}

Payment Validation

Validation will occur on each payment when adding Payment(s) to a Batch. A Payment must have at least a valid MSISDN and an amount to PAY. All validation must succeed before Payment(s) are added to the Batch.

Should validation fail when attempting to add a Payment, a 400 Bad Request will be returned with an array of validation failures:

[
  {
    "errorMessage": "string",
    "fieldName": "string",
    "fieldValue": "string"
  }
]
Field
Response Type
Description

errorMessage

string

A friendly description of the validation error

fieldName

string

The Field that failed validation, .e.g msisdn

fieldValue

string

The Value for the field that failed validation

The following is an example payload and responses that failed validation:

Sample Payload
{
  "clearExisting": true,
  "payments": [
    {
      "msisdn": "0821231234",
      "amount": 10,
      "firstname": "Test",
      "lastname": "User 1"
    },
    {
      "msisdn": "27821231235",
      "amount": 5,
      "firstname": "Test",
      "lastname": "User 2"
    },
    {
      "msisdn": "27821231236",
      "firstname": "Test",
      "lastname": "User 3"
    }
  ]
}
Sample Response
[
  {
    "errorMessage": "Msisdn invalid",
    "fieldName": "Msisdn",
    "fieldValue": "0821231234"
  },
  {
    "errorMessage": "Amount must be >= 1 DZAR",
    "fieldName": "Amount",
    "fieldValue": "0.0"
  }
]

Last updated