我已阅读并测试了过去2天如何将paypal网站专业版整合到我当前的网站。
我正在使用paypal最新的SDK,可以下载:https://www.x.com/developers/paypal/documentation-tools/paypal-sdk-index
到目前为止,我已设法添加运输/ CC详细信息,项目详细信息,税务详细信息以及其他所有内容。我唯一的问题是如何添加优惠券。我到处寻找一种方法,我找不到它。
我正在尝试整合直接付款。并快递退房 - 目前我正在进行直接付款
这是我到目前为止所获得的代码,其中大部分都位于他们的示例文件中。
$firstName = $_POST['firstName'];
$lastName = $_POST['lastName'];
$address = new AddressType();
$address->Name = "$firstName $lastName";
$address->Street1 = $_POST['address1'];
$address->Street2 = $_POST['address2'];
$address->CityName = $_POST['city'];
$address->StateOrProvince = $_POST['state'];
$address->PostalCode = $_POST['zip'];
$address->Country = $_POST['country'];
$address->Phone = $_POST['phone'];
$shippingTotal = new BasicAmountType($currencyCode, 25);
$handlingTotal = new BasicAmountType($currencyCode, 0);
$insuranceTotal = new BasicAmountType($currencyCode, 0);
$paymentDetails = new PaymentDetailsType();
$itemTotalValue = 0;
$taxTotalValue = 0;
$itemTotalValue += 15 * 2;
$taxTotalValue += 0 * 2;
$itemDetails = new PaymentDetailsItemType();
$itemDetails->Name = 'First Item';
$itemDetails->Amount = new BasicAmountType($currencyCode, 15);
$itemDetails->Quantity = 2;
$itemDetails->ItemCategory = 'Digital';
$itemDetails->Tax = new BasicAmountType($currencyCode, 0);
$paymentDetails->PaymentDetailsItem[0] = $itemDetails;
//}
$orderTotalValue = $shippingTotal->value + $handlingTotal->value +
$insuranceTotal->value +
$itemTotalValue + $taxTotalValue;
$paymentDetails->ShipToAddress = $address;
$paymentDetails->ItemTotal = new BasicAmountType($currencyCode, $itemTotalValue);
$paymentDetails->OrderTotal = new BasicAmountType($currencyCode, $orderTotalValue);
$paymentDetails->TaxTotal = new BasicAmountType($currencyCode, $taxTotalValue);
$paymentDetails->PaymentAction = $_REQUEST['paymentType'];
$paymentDetails->HandlingTotal = $handlingTotal;
$paymentDetails->InsuranceTotal = $insuranceTotal;
$paymentDetails->ShippingTotal = $shippingTotal;
if(isset($_REQUEST['notifyURL']))
{
$paymentDetails->NotifyURL = $_REQUEST['notifyURL'];
}
我已经挖过他们的课程并找到了一个班级名称:OfferCouponInfoType
这似乎做了我想要实现的目标,但我不知道如何使用它。