gpt4 book ai didi

php - Paypal 定期付款与首付款

转载 作者:太空宇宙 更新时间:2023-11-03 15:50:52 25 4
gpt4 key购买 nike

你好,我我正在使用带有商家 sdk 的 paypal 快速结账。
我已经使用集成手册实现了定期付款,但给定的示例没有
进行初始付款(立即向用户收费)。我的付款代码是:

初始化支付:

    $cart = $this->cart->getCart();
$items = $cart['items'];
$itemTotal = 0;

foreach ($items as $k => $item) {
$product = $this->addItem($item);
$itemTotal += $product->Amount;
$this->paymentDetails->PaymentDetailsItem[$k] = $product;
}

$this->orderTotal->currencyID = 'USD';
$this->orderTotal->value = $this->cart->getCartAmount();

$this->paymentDetails->OrderTotal = $this->orderTotal;
$this->paymentDetails->PaymentAction = 'Sale';
$this->paymentDetails->InvoiceID = $invoice_id->{'$id'};

$setECReqDetails = new \PayPal\EBLBaseComponents\SetExpressCheckoutRequestDetailsType();
$setECReqDetails->PaymentDetails[0] = $this->paymentDetails;
$setECReqDetails->CancelURL = $this->cancelURL;

$setECReqDetails->ReturnURL = $this->returnURL;

$billingAgreementDetails = new \PayPal\EBLBaseComponents\BillingAgreementDetailsType('RecurringPayments');
$billingAgreementDetails->BillingAgreementDescription = 'recurringbilling';
$setECReqDetails->BillingAgreementDetails = array($billingAgreementDetails);

$setECReqType = new \PayPal\PayPalAPI\SetExpressCheckoutRequestType();
$setECReqType->Version = $this->version;
$setECReqType->SetExpressCheckoutRequestDetails = $setECReqDetails;

$setECReq = new \PayPal\PayPalAPI\SetExpressCheckoutReq();
$setECReq->SetExpressCheckoutRequest = $setECReqType;

return $this->paypalService->SetExpressCheckout($setECReq);

然后在我提供的返回 url 上,我使用以下代码创建定期付款:

$profileDetails = new \PayPal\EBLBaseComponents\RecurringPaymentsProfileDetailsType();
$profileDetails->BillingStartDate = "2014-01-24T00:00:00:000Z";

$paymentBillingPeriod = new \PayPal\EBLBaseComponents\BillingPeriodDetailsType();
$paymentBillingPeriod->BillingFrequency = 10;
$paymentBillingPeriod->BillingPeriod = "Day";
$paymentBillingPeriod->Amount = new \PayPal\CoreComponentTypes\BasicAmountType("USD", "1.0");
$scheduleDetails = new \PayPal\EBLBaseComponents\ScheduleDetailsType();
$activationDetails = new \PayPal\EBLBaseComponents\ActivationDetailsType();
$activationDetails->InitialAmount = new \PayPal\CoreComponentTypes\BasicAmountType('USD', 49);
$activationDetails->FailedInitialAmountAction = 'ContinueOnFailure';
$scheduleDetails->Description = "recurringbilling";
$scheduleDetails->ActivationDetails = $activationDetails;
$scheduleDetails->PaymentPeriod = $paymentBillingPeriod;

$createRPProfileRequestDetails = new \PayPal\EBLBaseComponents\CreateRecurringPaymentsProfileRequestDetailsType();
$createRPProfileRequestDetails->Token = $token;

$createRPProfileRequestDetails->ScheduleDetails = $scheduleDetails;
$createRPProfileRequestDetails->RecurringPaymentsProfileDetails = $profileDetails;

$createRPProfileRequest = new \PayPal\PayPalAPI\CreateRecurringPaymentsProfileRequestType();
$createRPProfileRequest->CreateRecurringPaymentsProfileRequestDetails = $createRPProfileRequestDetails;

$createRPProfileReq = new \PayPal\PayPalAPI\CreateRecurringPaymentsProfileReq();
$createRPProfileReq->CreateRecurringPaymentsProfileRequest = $createRPProfileRequest;

return $this->paypalService->CreateRecurringPaymentsProfile($createRPProfileReq);
}

在我的沙盒帐户中,我可以看到已创建定期付款,但没有初始付款。我的问题是:如何设置此定期付款,以便进行初始付款?

希望我已经很好地解释了我的问题。如果您需要更多信息,请评论。

EIDT:我的问题是如何创建包含初始付款的定期付款。我编辑了我的代码片段。阅读后我发现我错过了设置“ActivationDetailsType”的设置。我设置了它,它在一个问题上运行良好……付款配置文件待处理 4-5 小时,然后通过。我在论坛等地方读到...这是一个沙盒问题,但不幸的是我不能确定付款不会被延迟。就我而言,我需要立即批准付款。我的新问题是,在创建经常性付款配置文件时,帐户的响应正常(成功或不成功)并且配置文件处于待处理状态,我可以将付款视为成功并确保我一定会收到钱吗

谢谢你的时间。问候,乔治

最佳答案

很晚了,但我也有类似的担忧。

My new question is, when creating recurring payment profile, and the response for the account is ok(succes or what not) and the profile is pending can i count the payment as successful and be sure i`ll get the money for sure?

我目前正在处理它,但在 PayPal 反射(reflect)付款之前我不会计算付款。我会利用 IPN 触发付款完成后应执行的操作。至于 PayPal 的 4-5 小时处理(尽管来自网络的消息称生产不应该有相同的延迟),我会确保通知买家他/她的付款仍在由 PayPal 处理。

关于php - Paypal 定期付款与首付款,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21330964/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com