Collect down payment in brick and mortar store

If you want to enable down payments collection at your brick and mortar store, please follow this guide.

The following map will show you a process flow to help you understand the interactions that must happen between your salesman/cashier and your customer when financing a product with aCuotaz. In parallel, it also shows the interactions between aCuotaz and your invoicing software through APIs.

Diagrama de flujo

Process flow summary

Endpoints

We use a REST JSON API.


Verify funding_code and funding conditions

Validates whether the provided dni/ruc and funding_code are valid and returns information about the down payment amount the store needs to collect and the number and amount of installments the customer needs to pay aCuotaz. In some ocassions, aCuotaz will extend extra credit line to customers during their application process. Customers may opt to use the credit line by selecting extra items at your store. Thus, changing the final billed amount. In those cases, this API will recalculate the amount of installments and the down payment amount. Note that we won't ask the customer´s confirmation for his new credit conditions. However, we will notify them via sms and email, and your cashier will also have that information available.

The merchant is responsible for checking whether the funding code is valid through this endpoint.

URL:

https://apurata.com/pos/client/inhouse-downpayment/v3/verify-fundingcode-and-conditions

Method: POST

Request body:

{
    dni: [string],
    ruc: [string],            # DNI or RUC can be sent to identify the operation
    funding_code: [string],
    billed_amount: [float],
    cashier_id: [string]      # ID of the cashier processing the transaction
}

Success Response:

Code: 200 OK
{
  dni: [string],                        # Could be ruc instead
  funding_code: [string],
  billed_amount: [float],
  billed_by_ecommerce: [bool],

  approved_amount: [float],
  excedent_amount: [float],             # billed_amount - approved_amount

  downpayment_amount: [float],          # Total down payment amount
  downpayment_amount_inhouse: [float],  # downpayment_amount - already_paid_in_acuotaz_platform

  installments_number: [int],           # Does not include down payment
  installments_amount: [float],         # Other than down payment amount
}

To clarify some concepts:

Sample curl:

    curl 'https://apurata.com/pos/client/inhouse-downpayment/v3/verify-fundingcode-and-conditions' \
  -H 'Authorization: Bearer 5f80f8c488b0458db0603e85a38b62c5' \
  -H 'Content-Type: application/json' \
  --data '{"dni": "14159265", "funding_code": "1234567", "billed_amount":100}'

Error Responses:

Code: 401 UNAUTHORIZED
{ error: "Wrong or missing client token" }

Code: 404 NOT FOUND
{ error: "Funding code does not exist or not active" }

Code: 404 NOT FOUND
{ error: "Financing DNI does not match with the DNI sent" }

Code: 400 BAD REQUEST
{ dni: "Error on dni format", funding_code: "Error on funding_code format" }

Code: 400 BAD REQUEST
{ error: "cashier_id changed" }

Code: 400 BAD REQUEST
{ error: "billed_amount cannot change after being marked as billed" }

Code: 400 BAD REQUEST
{ error: "Your store is not allowed to use this endpoint" }

Receive down payment and billing

Only orders we successfully marked as billed with this endpoint will be billable to aCuotaz. The store is responsible for any products delivered without receiving confirmation from us through this endpoint.

This endpoint verifies two things:

  1. That the billed_amount didn´t change
  2. That the user accepted the new installment schedule (we may request it in some ocassions for risk managment reasons).

If you get the error "billed_amount changed", you need to call the previous endpoint again: Verify funding_code and funding conditions

If you get the error "Customer did not accept new installment schedule yet", you need to ask your customer to review and accept the new installment schedule in the aCuotaz website.

You should call this API before generating an invoice in your invoice system, but after collecting the down payment. This way, if we have an error preventing the billing process, you don't have to undo your billing.

If you call this API several times, only the first one will have effect. After you get success response from this API, if you call the endpoint Verify funding_code and funding conditions, the field billed_by_ecommerce will be True and if there was no excedent_amount the downpayment_amount_inhouse will show the amount you should have collected from the customer

URL: https://apurata.com/pos/client/inhouse-downpayment/v3/paid-and-billed

Method: POST

Request body:

{
    dni: [string],
    ruc: [string],            # DNI or RUC can be sent to identify the operation
    funding_code: [string],
    billed_amount: [float],
    cashier_id: [string]      # ID of the cashier processing the transaction
}

Success Response:

Code: 200 OK

Sample curl:

    curl 'https://apurata.com/pos/client/inhouse-downpayment/v3/paid-and-billed' \

      -H 'Authorization: Bearer 69a06d50c17e4267a18e84f8530d6asd' \
      -H 'Content-Type: application/json' \
      --data '{"dni": "14159265", "funding_code": "1234567", "billed_amount":100}'

Error Responses:

Code: 401 UNAUTHORIZED
{ error: "Wrong or missing client token" }

Code: 404 NOT FOUND
{ error: "Funding code does not exist or not active" }

Code: 400 BAD REQUEST
{
    dni: "Error on dni format",
    funding_code: "Error on funding_code format"
}

Code: 400 BAD REQUEST
{ error: "billed_amount changed" }

Code: 400 BAD REQUEST
{ error: "cashier_id changed" }

Code: 400 BAD REQUEST
{ error: "Client not enabled to use this API" }

Code: 400 BAD REQUEST
{ error: "Customer did not accept new installment schedule yet" }

Undo billing

Notify aCuotaz the billing of a funding_code was undone, so the endpoint Receive downpayment and billing can be used again. The down payment stays as paid though.

URL: https://apurata.com/pos/client/inhouse-downpayment/v3/undo-billing

Method: POST

Request body:

{
    dni: [string],              # DNI or RUC can be sent to identify the operation
    ruc: [string],              # Only RUCs starting with '10' are supported
    funding_code: [string]
}

Success Response:

Code: 200 OK

Sample curl:

    curl 'https://apurata.com/pos/client/inhouse-downpayment/v3/undo-billing' \

      -H 'Authorization: Bearer 69a06d50c17e4267a18e84f8530d6asd' \
      -H 'Content-Type: application/json' \
      --data '{"dni": "14159265", "funding_code": "1234567", "billed_ampunt": 1000}'

Error Responses:

Code: 401 UNAUTHORIZED
{ error: "Wrong or missing client token" }

Code: 404 NOT FOUND
{ error: "Funding code does not exist or not active" }

Code: 400 BAD REQUEST
{ error: "Not billed yet" }

150 Code: 400 BAD REQUEST { dni: "Error on dni format", funding_code: "Error on funding_code format" }

Code: 400 BAD REQUEST
{ error: "This lend don't have downpayment, lend :XXXXXXXXXXX" }

Code: 400 BAD REQUEST
{ error: "The origin of the first payment is not external, len :XXXXXXXXX" }

Code: 400 BAD REQUEST
{ error: "This lend has not only 1 (one) payment, len : XXXXXXXXXX" }

Examples

Down Payment Fully Collected at Store:

Case: Approved amount greater than purchased items price

The customer requests financing for S/200, but later decides to purchase a S/150 item. The store invoice system will call the endpoint

URL:

https://apurata.com/pos/client/inhouse-downpayment/v3/verify-fundingcode-and-conditions

Method: POST

Request body:

{
    dni: '14159265',
    funding_code: '1234567',
    billed_amount: 150,
    cashier_id: 'cashier123'  # ID of the cashier processing the transaction
}

with a billled_amount of S/150. The endpoint will recalculate the new down payment and installments amount. For example, if the customer wanted to pay in 4 interest free installments. The down payment and the amount of installments will change from S/50 (S/200 / 4) to S/37.5 (S/150 / 4).

Success Response: (billed_amount:200)

Code: 200 OK
{
  dni: '14159265',
  funding_code: '1234567'
  billed_amount: 200,
  billed_by_ecommerce: False,
  approved_amount: 200,
  excedent_amount: 0,
  downpayment_amount: 50,
  downpayment_amount_inhouse: 50,
  installments_number: 3,
  installments_amount: 50,
}

Success Response: (billed_amount:150)

Code: 200 OK
{
  dni: '14159265',
  funding_code: '1234567'
  billed_amount: 150,
  billed_by_ecommerce: False,
  approved_amount: 150,
  excedent_amount: 0,
  downpayment_amount: 37.5,
  downpayment_amount_inhouse: 37.5,
  installments_number: 3,
  installments_amount: 37.5,
}

Case: Purchased items price exceeds approved amount but are within credit line limit

The customer requests financing for S/200 and during the application process we inform the customer that he has access to a S/600 credit line . The customer later decides to purchase items worth S/400. The store invoice system will call the endpoint

URL:

https://apurata.com/pos/client/inhouse-downpayment/v3/verify-fundingcode-and-conditions

Method: POST

Request body:

{
    dni: '14159265',
    funding_code: '1234567',
    billed_amount: 400,
    cashier_id: 'cashier123'  # ID of the cashier processing the transaction
}

with a billled_amount of S/400. The endpoint will recalculate the new down payment and installments amount. For example, if the customer wanted to pay in 4 interest free installments. The down payment and the amount of installments will change from S/50 (S/200 / 4) to S/100 (S/400 / 4).

Success Response: (billed_amount:200)

Code: 200 OK
{
  dni: '14159265',
  funding_code: '1234567',
  billed_amount: 200,
  billed_by_ecommerce: False,
  approved_amount: 200,
  excedent_amount: 0,
  downpayment_amount: 50,
  downpayment_amount_inhouse: 50,
  installments_number: 3,
  installments_amount: 50,
}

Success Response: (billed_amount:400)

Code: 200 OK
{
  dni: '14159265',
  funding_code: '1234567',
  billed_amount: 400,
  billed_by_ecommerce: False,
  approved_amount: 400,
  excedent_amount: 0,
  downpayment_amount: 100,
  downpayment_amount_inhouse: 100,
  installments_number: 3,
  installments_amount: 100,
}

Case: Purchased items price exceeds credit line

The customer requests financing for S/200 and during the application process we inform the customer that he has access to a S/600 credit line. The customer later decides to purchase items worth S/800. The store invoice system will call the endpoint

URL:

https://apurata.com/pos/client/inhouse-downpayment/v3/verify-fundingcode-and-conditions

Method: POST

Request body:

{
    dni: '14159265',
    funding_code: '1234567',
    billed_amount: 800,
    cashier_id: 'cashier123'  # ID of the cashier processing the transaction
}

with a billled_amount of S/800. The endpoint will recalculate the new down payment and installments amount for S/600. The portion of the sale that will not be financed by aCuotaz will be the excedent amount (billed amount - credit line). In this example, the excedent amount is S/200. For example, if the customer wanted to pay in 4 interest free installments. The down payment and the amount of installments will change from S/50 (S/200 / 4) to S/150 (S/600 / 4). In addition, the store must collect the excedent amount of S/200 to complete the purchase. From the customer perspective, he will have to pay a total of S/350 (S/150 aCuotaz down payment and S/200 excedent amount) and then 3 more installments of S/150 each.

Success Response: (billed_amount:200)

Code: 200 OK
{
  dni: '14159265',
  funding_code: '1234567',
  billed_amount: 200,
  billed_by_ecommerce: False,
  approved_amount: 200,
  excedent_amount: 0,
  downpayment_amount: 50,
  downpayment_amount_inhouse: 50,
  installments_number: 3,
  installments_amount: 50,
}

Success Response: (billed_amount:800)

Code: 200 OK
{
  dni: '14159265',
  funding_code: '1234567',
  billed_amount: 800,
  billed_by_ecommerce: False,
  approved_amount: 600,
  excedent_amount: 200,
  downpayment_amount: 150,
  downpayment_amount_inhouse: 150,
  installments_number: 3,
  installments_amount: 150,
}

Down Payment Collected by aCuotaz before Customer Validation:

Case: Approved amount is greater than price of purchased items

The customer requests financing for S/200 and makes the down payment directly to aCuotaz through credit/debit card or direct transfer, but later decides to purchase a S/150 item. The store invoice system will call the endpoint

URL:

https://apurata.com/pos/client/inhouse-downpayment/v3/verify-fundingcode-and-conditions

Method: POST

Request body:

{
    dni: '14159265',
    funding_code: '1234567',
    billed_amount: 150,
    cashier_id: 'cashier123'  # ID of the cashier processing the transaction
}

with a billled_amount of S/150. The endpoint will recalculate the new down payment and installments amount. For example, if the customer wanted to pay in 4 interest free installments. The down payment and the amount of installments will change from S/50 (S/200 / 4) to S/37.5 (S/150 / 4). Since the customer already paid S/50 to aCuotaz, we will credit the difference between what we originally collected and what is owed S/12.5 (S/50-S/37.5) to his next installment.

Success Response: (billed_amount:200)

Code: 200 OK
{
  dni: '14159265',
  funding_code: '1234567',
  billed_amount: 200,
  billed_by_ecommerce: False,
  approved_amount: 200,
  excedent_amount: 0,
  downpayment_amount: 50,
  downpayment_amount_inhouse: 50,
  installments_number: 3,
  installments_amount: 50,
}

Success Response: (billed_amount:150)

Code: 200 OK
{
  dni: '14159265',
  funding_code: '1234567',
  billed_amount: 150,
  billed_by_ecommerce: False,
  approved_amount: 150,
  excedent_amount: 0,
  downpayment_amount: 37.5,
  downpayment_amount_inhouse: 37.5,
  installments_number: 3,
  installments_amount: 37.5,
}

Case: Purchased items price exceeds either the approved amount or the credit line

The customer requests financing for S/200 and makes the down payment directly to aCuotaz through credit/debit card or direct transfer. During the application process we inform the customer that he has access to a S/600 credit line . The customer later decides to purchase items worth S/400. The store invoice system will call the endpoint

URL:

https://apurata.com/pos/client/inhouse-downpayment/v3/verify-fundingcode-and-conditions

Method: POST

Request body:

{
    dni: '14159265',
    funding_code: '1234567',
    billed_amount: 400,
    cashier_id: 'cashier123'  # ID of the cashier processing the transaction
}

with a billled_amount of S/400. The endpoint will recalculate the new down payment and installments amount. For example, if the customer wanted to pay in 4 interest free installments. The down payment and the amount of installments will change from S/50 (S/200 / 4) to S/100 (S/400 / 4). Since the customer already paid S/50 to aCuotaz, the endpoint will calculate the extra amount the customer needs to pay to complete the new down payment of S/100. In this case, it will be S/50 (S/100 - S/50). This data point will be informed to you as downpayment_inhouse.

Success Response: (billed_amount:200)

Code: 200 OK
{
  dni: '14159265',
  funding_code: '1234567',
  billed_amount: 200,
  billed_by_ecommerce: False,
  approved_amount: 200,
  excedent_amount: 0,
  downpayment_amount: 50,
  downpayment_amount_inhouse: 50,
  installments_number: 3,
  installments_amount: 50,
}

Success Response: (billed_amount:400)

Code: 200 OK
{
  dni: '14159265',
  funding_code: '1234567',
  billed_amount: 400,
  billed_by_ecommerce: False,
  approved_amount: 400,
  excedent_amount: 0,
  downpayment_amount: 100,
  downpayment_amount_inhouse: 50,
  installments_number: 3,
  installments_amount: 100,
}