Transaction.addressAndSalesTaxFromPayPalOrder
Web Session Object
Transaction Object
Token Object
Season Set Object
Refund Object
RatePlan Object
Product Object
Payment Provider Object
Payment Method Object
NameValuePair Object
GiftCard Object
Entitlement Object
Chargeback Object
Campaign Object
BillingPlan Object
AutoBill Object
Address Object
Activity Object
Account Object
Transaction.addressAndSalesTaxFromPayPalOrder
The addressAndSalesTaxFromPayPalOrder method allows you to fetch customer billing and shipping addresses from PayPal. This enables Vindicia Subscribe to correctly calculate and apply tax on the current PayPal Transaction. This call is intended for merchants who do not collect address information from their customers. Vindicia Subscribe updates Payment Methods on the Account object with the billing and shipping addresses returned by this call, to be used on the current, and on future, one-time and recurring PayPal Transactions.
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 Vindicia Subscribe 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 in the name–value pairs attached to the redirect URL. name: vindicia_vid
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