Set partner invoice payment details (card payment)
Overview
Configure the details of the payment method that will be used to pay for a partner invoice. Supported payment methods:
- PayPal
- Credit / debit cards
Works in conjunction with setProforma and is a prerequisite for payProforma. Call setProforma, then setPaymentDetails and payProforma in this specific order to pay for a partner invoice.
Requirements
This method requires that a specific partner be set using setPartner and that a partner invoice be marked for payment using setProforma.
Parameters
Parameters | Type/Description | ||
---|---|---|---|
sessionID |
Required (String) |
||
|
Session identifier, output of the Login method. An exception is thrown if the values are incorrect. |
||
paymentDetails |
Object |
||
|
Payment details object with the structure detailed below. |
||
|
Type |
String |
|
|
|
Possible values:
|
|
|
Currency |
String |
|
|
|
Partner currency ISO code - ISO 4217. This currency governs transactions between you and the partner, and is set in the Commercial Settings page, under Payment information. Must match the currency of the partner invoice, otherwise an exception is thrown. If NULL, the system uses the partner invoice currency. |
|
|
PaymentMethod |
Object |
|
|
|
Structure below. |
|
|
|
CardNumber |
String |
|
|
|
Credit / debit card number |
|
|
CardType |
String |
|
|
|
Credit / debit card type:
|
|
|
CCID |
String |
|
|
|
CVC2/CVV2 card identification number. |
|
|
ExpirationMonth |
String |
|
|
|
A valid expiration month must be used, otherwise an exception is thrown. Example: 06 for June. |
|
|
ExpirationYear |
String |
|
|
|
A valid expiration year must be used, otherwise an exception is thrown |
|
|
HolderName |
String |
|
|
|
Card holder name |
|
CustomerIP |
String |
|
|
|
Partner IP address, needed for security validation. |
Response
Parameters | Type/Description |
---|---|
Result | Boolean |
True or false. |
Request
<?php
require ('PATH_TO_AUTH'); // Authentication example: https://knowledgecenter.avangate.com/Integration/Channel_Manager_API/JSON-RPC/02Authentication
require ('PATH_TO_setPartner'); // setPartner example: https://knowledgecenter.avangate.com/Integration/Channel_Manager_API/JSON-RPC/06Reference/Partner/00Set_partner
require ('PATH_TO_setProforma'); // setProforma example: https://knowledgecenter.avangate.com/Integration/Channel_Manager_API/JSON-RPC/06Reference/14Billing/00Capture_card_payment/00Set_partner_invoice
$paymentDetails = new stdClass();
$paymentDetails->Type = 'CC';
$paymentDetails->Curency = 'YOUR_CURRENCY';
$paymentDetails->CustomerIP = 'CUSTOMER_IP';
$paymentDetails->PaymentMethod = new stdClass();
$paymentDetails->PaymentMethod->CardNumber = 'YOUR_CARD_NUMBER';
$paymentDetails->PaymentMethod->CardType = 'YOUR_CARD_TYPE';
$paymentDetails->PaymentMethod->CCID = 'YOUR_CARD_CVV';
$paymentDetails->PaymentMethod->ExpirationMonth = 'CARD_EXPIRATION_MONTH';
$paymentDetails->PaymentMethod->ExpirationYear = 'CARD_EXPIRATION_YEAR';
$paymentDetails->PaymentMethod->HolderName = 'CARDHOLDER_NAME';
$jsonRpcRequest = array (
'jsonrpc' => '2.0',
'id' => $i++,
'method' => 'setPaymentDetails',
'params' => array($sessionID, $paymentDetails)
);
var_dump (callRPC((Object)$jsonRpcRequest,$host));
Errors
Error | Description |
---|---|
INVALID_PARTNER |
No partner is set. |
INVALID_PROFORMA |
No partner invoice set. |
PAYMENT_ERROR |
Your currency is not supported. You can only pay in: |
PAYMENT_ERROR |
You did not set your PaymentMethod property. |
PAYMENT_ERROR |
Your PaymentMethod property ['.$_prop.'] is not defined. |
PAYMENT_ERROR |
Your payment type is not supported. We only accept PAYPAL and CC. |
PAYMENT_ERROR |
We cannot detect the business model |
PAYMENT_ERROR |
There are no payment methods for this currency |
PAYMENT_ERROR |
Your payment method is not supported |
PAYMENT_ERROR |
Invalid credit card |