Confirm payment for Proforma Invoices
Last updated: 08-Feb-2019
Rate this article:
Overview
Use this method to confirm the payment for proforma invoices issued to your partners on the Direct Payment module. To confirm the payment for a proforma invoice, you need to follow these steps before calling the confirmInvoicePayment API method:
- Authenticate to 2Checkout API based on these instructions.
- Set the partner for which you want to confirm the payment (method explained in the sample below).
- Set the proforma invoice (method explained in the sample below).
- Confirm the payment using the instructions below.
Requirements
You can confirm payments only for partners set with Direct business model. Learn here how to set a business model to your partners.
Parameters
Parameters | Type/Description |
---|---|
sessionID | Required (String) |
Session identifier, output of the Login method. An exception is thrown if the values are incorrect. | |
partnerCode | Required (String) |
The unique identifier that you need to specify when creating a partner in the Control Panel. You can find it under the General Information area when editing partner details. | |
proformaNo | Required (String) |
The unique identifier of a partner invoice from the 2Checkout system. | |
rrn | Optional (String) |
The code associated with the proforma invoice payment reference (receipt registration number). |
Response
Parameters | Type/Description | |
---|---|---|
TRUE FALSE |
Boolean True - method is successful False - method is not successful |
Error messages
Error code | Error description | |
---|---|---|
INVALID_PARTNER | No partner is set or the proforma does not belong to the partner set. | |
PAYMENT_PROFORMA | The proforma invoice has already been paid. | |
INVALID_PROFORMA | The proforma invoice number is invalid. | |
INVALID_METHOD | The partner set is not on the Direct business model. |
Request
<?php
require ('PATH_TO_AUTH'); // Authentication example: https://knowledgecenter.avangate.com/Integration/Channel_Manager_API/JSON-RPC/02Authentication
require ('PATH_TO_SET_PARTNER'); // setPartner example: https://knowledgecenter.avangate.com/Integration/Channel_Manager_API/JSON-RPC/06Reference/Partner/00Set_partner
$partnerCode = 'partner_code'; // direct
$jsonRpcRequest = new stdClass();
$jsonRpcRequest->jsonrpc = '2.0';
$jsonRpcRequest->method = 'setPartner';
$jsonRpcRequest->params = array($sessionID, $partnerCode);
$jsonRpcRequest->id = $i++;
$partner = callRPC($jsonRpcRequest, $host, true);
// call setPartner
$proformaNo = '6'; // not paid reseller direct but before was reseller
$jsonRpcRequest = new stdClass();
$jsonRpcRequest->jsonrpc = '2.0';
$jsonRpcRequest->method = 'setProforma';
$jsonRpcRequest->params = array($sessionID, $proformaNo);
$jsonRpcRequest->id = $i++;
$proforma = callRPC($jsonRpcRequest, $host, true);
$rrn = 'refnostril'; // controls payment reference
// $rrn = '';
//call confirmInvoicePayment
$jsonRpcRequest = new stdClass();
$jsonRpcRequest->jsonrpc = '2.0';
$jsonRpcRequest->method = 'confirmInvoicePayment';
$jsonRpcRequest->params = array($sessionID, $rrn);
$jsonRpcRequest->id = $i++;
$paymentConfirmation = callRPC($jsonRpcRequest, $host, true);
print_r(json_encode($paymentConfirmation));
Rate this article: