Community Forum

Ask a Question
Back to All

Payments API: Failure Reason and Comms Super Buggy

(edited)

Good day,

We have been battling to work out how to get the payments API to work as expected.
We either get failure reasons for payments to pull through to the UI and then no comms fire or we get comms to fire but then our async updates to failure reason does not work.

An example of a policy where we have this is here: https://app.root.co.za/orgs/f0f74964-62a3-4bf1-9077-e6059a5c2ae2/insurance/policies/693814b4-fa55-4db7-b6a1-b7857eef0c95

  1. For the first payment (comms fire, failure reason not pulling through with an update):
    1. We created the payment with a FAILED status, we then tried updating it using the payments endpoint and the job returned an OK
      1. The payment did not update as far as we can see to include the failure reason we sent
      2. The email and SMS comms did fire
  2. For the second batch (comms don't fire, failure reason does pull through with an update)
    1. We create the intial payments in PROCESSING or SUBMITTED
    2. We then update using the update endpoint
      1. The update to add the failure reason (as the creat endpoint does not allow it to be specified) does not result in the payment object updating at all
      2. The SMS and email comms do fire
    3. Emails and SMS do not fire
    4. The failure update reflects both on the object and the UI
      1. The updated at does not change
      2. The finalized at does seem to have changed
      3. Everything on the update object is required (the docs say only payment_id and status are required)

Can you please assist with the above?

Additionally, is there a DELETE endpoint? If not how would we delete payments if we needed to?

I don't have the first payment's create and update requests but the second batches are:

Create the initial payments

[
    {
        "status": "submitted",
        "payment_type": "premium",
        "premium_type": "recurring",
        "amount": 123,
        "description": "Failed-Test-submitted-premium-recurring-do-2-day",
        "payment_date": "2022-10-10T00:00:00.000Z",
        "collection_type": "debit_order_two_day",
        "external_reference": "233c9210-submitted-premium-recurring-do-2-day",
        "policy_id": "693814b4-fa55-4db7-b6a1-b7857eef0c95"
    },
    {
        "status": "processing",
        "payment_type": "premium",
        "description": "Failed-Test-processing-premium-recurring-do-2-day",
        "premium_type": "recurring",
        "amount": 456,
        "external_reference": "233c9210-processing-premium-recurring-do-2-day",
        "payment_date": "2022-10-10T00:00:00.000Z",
        "collection_type": "debit_order_two_day",
        "policy_id": "693814b4-fa55-4db7-b6a1-b7857eef0c95"
    }
]

Update the above payments

[
    {
        "payment_id": "6b13355f-8c38-4efb-9ced-8db4bf118eb0",
        "status": "failed",
        "failure_reason": "Account closed - Failed-Test-submitted-premium-recurring-do-2-day",
        "failure_action": "block_payment_method"
    },
    {
        "payment_id": "d2d85efa-f209-4bb1-94df-2df1b0fee441",
        "status": "failed",
        "failure_reason": "Account closed - Failed-Test-processing-premium-recurring-do-2-day",
        "failure_action": "block_payment_method"
    }
]