Skip to main content
Vindicia Knowledge Center

Transaction.addressAndSalesTaxFromPayPalOrder

Transaction.addressAndSalesTaxFromPayPalOrder

Transaction.addressAndSalesTaxFromPayPalOrder

The addressAndSalesTaxFromPayPalOrder method allows you to fetch the billing and shipping addresses from PayPal, and apply tax to Transactions.

This call will calculate taxes using the billing address obtained from PayPal, and is recommended for merchants who do not collect this address information from their customers.

Billing and shipping addresses are only applied to the current Transaction and will not be stored in CashBox for use in subsequent Transactions. If you wish these values to be stored for use in later one-time or recurring PayPal transactions, you must do so manually.

Note You must be approved by PayPal, and your Seller Account enabled for the Billing Address feature, to use this method successfully. Once you have established this relationship with PayPal, please work with your Vindicia Client Services representative to enable the feature for your CashBox account.

The Shipping Address will be always returned by this call, even without completing these required steps for the Billing Address return.

Input

srd: sparse response description, a SOAP string (which must be a JSON object), in which you specify the elements you want returned.This parameter enables the calling system to constrain a method call to return only components you specify. This gives you greater control over returned content, and improves response time within the Vindicia platform by reducing the processing needed for the call.

Some fields are required, either practically or in the WSDL, and will be returned regardless of the srd. A null srd returns the complete response.

payPalTransactionId: Vindicia’s ID for the PayPal payment method validation Transaction, generated when you called AutoBill.update. Retrieve this ID from the value associated with the name:vindicia_vid in the name–value pairs attached to the redirect URL.

Output

return: an object of type Return that indicates the success or failure of the call.

transaction: an object of type Transaction.

SalesTaxAddress: an object of type Address that describes the PayPal listed sales tax address for the Transaction.

BillingAddress: an object of type Address that describes the PayPal listed billing address for the Transaction.

ShippingAddress: an object of type Address that describes the PayPal listed shipping address for the Transaction.

taxItems: an object of type SalesTax that describes the total amount for taxable items included with the Transaction.

totalTax: the total amount of tax levied against the Transaction.

subtotalAmount: the pre-taxed total for the Transaction.

totalAmount: the post-tax total for the Transaction.

Returns

This method returns the codes listed in Standard Return Codes.

Examples

The following examples are for One-Time and Recurring Transactions. Both of these examples should be called on your PayPal Success page, after your Buyer has approved the Transaction. One-Time Transactions may use the same Transaction object for both Transaction.addressAndSalesTaxFromPayPalOrder and finalizePayPalAuth.

Note These examples differ only in that Recurring Transactions require that a separate object be created for the AutoBill to use to call finalizePayPalAuth.

One-Time

The following example demonstrates use of this method for a One-Time Transaction

 

$transaction = new Transaction();

// Obtain the id of the PayPal transaction from the redirect URL.

$payPalTxId = $_GET['vindicia_vid'];

// For a successfully authorized PayPal transaction,
// set the success input parameter to true.

$success = true;

// Fetch the Billing and Shipping Addresses from PayPal,
// and apply Tax to the Transaction using the returned addresses.

$response =
$transaction->addressAndSalesTaxFromPayPalOrder($payPalTxId);

// Update the PaymentMethod.billingAddress with the
// Billing Address returned by PayPal so it will be used
// to apply Tax to subsequent Transactions based on the Billing Address.

// (Optional.) Update Account.shippingAddress with
// the returned Shipping Address, so it will be used
// to apply Tax to subsequent Transactions
// (if there is not an existing Account.shippingAddress stored).

// To obtain Buyer confirmation of the modified
// Transaction amount, which now includes Tax,
// you must first interact with the Buyer in the User Interface,
// then, after Buyer approval, proceed to complete the Transaction.

// Finalize the Transaction

$response =
$response->finalizePayPalAuth($payPalTxId, $success);

if($response['returnCode'] == 200) {
$txId = $response['transaction']->getMerchantTransactionId();
printLog "Transaction authorized: " . $txId;
}

 

Recurring

The following example demonstrates use of this method for a Recurring (AutoBill) Transaction.

 

$autobill = new AutoBill();
$transaction = new Transaction();

// Obtain the id of the PayPal transaction from the redirect URL.

$payPalTxId = $_GET['vindicia_vid'];

// For a successfully authorized PayPal transaction,
// set the success input parameter to true.

$success = true;

// Fetch the Billing and Shipping Addresses from PayPal,
// and apply Tax to the Transaction using the returned addresses.

$response =
$transaction->addressAndSalesTaxFromPayPalOrder($payPalTxId);

// Update the PaymentMethod.billingAddress with the
// Billing Address returned by PayPal so it will be used
// to apply Tax to subsequent Transactions based on the Billing Address.

// (Optional.) Update Account.shippingAddress with
// the returned Shipping Address, so it will be used
// to apply Tax to subsequent Transactions
// (if there is not an existing Account.shippingAddress stored).

// To obtain Buyer confirmation of the modified
// Transaction amount, which now includes Tax,
// you must first interact with the Buyer in the User Interface,
// then, after Buyer approval, proceed to complete the Transaction.

//Finalize the Transaction:

$response =
$autobill->finalizePayPalAuth($payPalTxId, $success);

if($response['returnCode'] == 200) {
$txId = $response['transaction']->getMerchantTransactionId();
printLog "Transaction authorized: " . $txId;
}

For Users

Learn More
For Users

Cashbox Features

Learn More
Cashbox Features
Back to Top