Retrieve price based on specific options
Overview
Use getPrice to extract cost information for a product/subscription plan, based on a specific list of options.
Parameters
Parameters | Type/Description | |
---|---|---|
Item |
Required (Object) Details below. |
|
|
Code |
Required (string) |
|
|
Unique product identifier your control. Max length 256 characters. |
|
Quantity |
Required (String) |
|
|
Number of units. |
|
PriceOptions |
Optional (Array of objects) |
|
|
Array of price option groups. |
Options | Optional (Array of objects) | |
Array of pricing options. | ||
Value | Optional (String) | |
Pricing option code. | ||
Billing details |
Optional (Object) |
|
|
Details below. Can be null. |
|
|
FirstName |
Optional (string) |
|
|
Shopper name. |
|
LastName |
Optional (string) |
|
|
Shopper surname. |
|
CountryCode |
Optional (string) |
|
|
Shopper country. ISO 3166 two-letter code. Include CountryCode in your request in combination with a null value for Currency, to receive the price in the default currency of the country you set. |
|
State |
Optional (string) – Required for US, Brazil and Romania |
|
|
The state in the shopper's country. Mandatory when you set the Billing Country to US, Brazil and Romania. Use case insensitive utf8 strings for the full name, or just the two letter code. |
|
City |
Optional (string) |
|
|
Shopper city. |
|
Address1 |
Optional (string) |
|
|
Shopper address. |
|
Address2 |
Optional (string) |
|
|
Shopper address. |
|
Zip |
Optional (string) |
|
|
ZIP/ Postal code. |
|
|
Optional (string) |
|
|
Shopper email address. |
|
Phone |
Optional (string) |
|
|
Shopper phone number. Mandatory when you set Brazil as the Billing Country. Can be NULL. |
|
Company |
Optional (string) |
|
|
Company name. Can be null for end users. When present, you also need to provide the FiscalCode. |
|
FiscalCode |
Optional (string) – Required for Brazil |
|
|
• For companies, it needs to be the VAT ID. 2Checkout will validate the value provided and throw an error if the VAT ID is invalid/incorrect when calling setPaymentDetails. When present, you also need to provide the Company name. • Mandatory when you set Brazil as the Billing Country. For Brazilian customers it represents the Fiscal Code (CPF/CNPJ). • Can be NULL for end users. |
Currency |
Required (string) |
|
|
The currency ISO code for the payment - ISO 4217. Example: “usd.” |
|
CouponCode |
Optional (string) |
|
|
Promotion coupon/voucher. |
|
PayType |
Optional (string) |
|
|
The payment method:
|
Response
Parameters | Type/Description | ||
---|---|---|---|
ItemPrice |
Object Details below. |
||
UnitNetPrice |
Float |
||
|
The value per product unit, excluding sales tax/VAT expressed in the payment currency. |
||
UnitGrossPrice |
Float |
||
|
Total value per product unit, including sales tax/VAT expressed in the payment currency. UnitGrossPricedoes not reflect any discounts. |
||
UnitVAT |
Integer |
||
|
Sales tax/VAT per product unit expressed in the payment currency. |
||
UnitDiscount |
Integer | ||
|
Value of the discount per product unit expressed in the payment currency. |
||
UnitNetDiscountedPrice |
Float |
||
|
The value per product unit, expressed in the payment currency, excluding sales tax/VAT, from which 2Checkout deducts the unit discount. |
||
UnitGrossDiscountedPrice |
Float | ||
|
Total costs shoppers incur per product unit, expressed in the payment currency. This value includes sales tax/VAT, 2Checkout and affiliate commissions, but 2Checkout deducts the value of any discounts. |
||
UnitAffiliateCommission |
Integer |
||
|
Value of the affiliate commission per product unit calculated expressed in the payment currency.
2Checkout deducts discounts from the costs incurred by shoppers before calculating affiliate commissions.
2Checkout does not take into account shipping costs when calculating affiliate commissions.
NULL when 2Checkout does not apply an affiliate commission. |
||
VATPercent | Integer | ||
VAT percentage applied to purchase. | |||
HandlingFeeNetPrice | Integer | ||
Handling fee applied to your NET price configuration. | |||
HandlingFeeGrossPrice | Integer | ||
Handling fee applied to your GROSS price configuration. | |||
AffiliateCommission | Optional (double) | ||
Value of the affiliate commission for the order calculated from the NetDiscountedPrice expressed in the payment currency. Or NULL. 2Checkout does not take into account shipping costs when calculating affiliate commissions. | |||
Currency | Optional (string) | ||
The currency ISO code for the payment - ISO 4217. Example: “usd.” Use null as value when you include CountryCode in your request, to receive the price in the default currency of the country you set. | |||
Discount | Optional (double) | ||
Value of the discounts for an order expressed in the payment currency. | |||
GrossDiscountedPrice | Optional (double) | ||
Total costs shoppers incur, expressed in the payment currency. This value includes sales tax/VAT, 2Checkout and affiliate commissions, but 2Checkout deducts the value of any discounts. | |||
GrossPrice | Optional (double) | ||
Total order value, including sales tax/VAT expressed in the payment currency. GrossPrice does not reflect any discounts. | |||
NetDiscountedPrice | Optional (double) | ||
The NetPrice order value excluding sales tax/VAT, from which 2Checkout deducts discounts. NetDiscountedPriceis expressed in the payment currency. | |||
NetPrice | Optional (double) | ||
Order value excluding sales tax/VAT expressed in the payment currency. | |||
VAT | Optional (double) | ||
Value of sales tax/VAT expressed in the payment currency. |
Request
<?php
require ('PATH_TO_AUTH');
$CartItem = new stdClass();
$CartItem->Code = 'my_subscription_1';
$CartItem->Quantity = 1;
$CartItem->PriceOptions = array();
// $CartItem->Trial = new stdClass();
$CartItem->Trial->Period = 8;
$CartItem->Trial->Price = 0; //
$BillingDetails = NULL;
$Currency = 'USD';
$CouponCode = '123';
$PayType = 'CC';
try {
$itemPrice = $client->getPrice($sessionID, $CartItem, $BillingDetails, $Currency, $CouponCode, $PayType);
}
catch (SoapFault $e) {
echo "itemPrice: " . $e->getMessage();
exit;
}
var_dump("itemPrice", $itemPrice);