如何配置 Payum 以便它可以处理PayPal标准付款(不是快速结帐付款)



如何为Symfony配置Payum,以便它可以处理PayPal标准付款(不是快速结账付款(;与基本的PayPal按钮完全相同?

文档中提供的示例仅适用于快速结账:

public function prepareAction()
{
    $gatewayName = 'paypal_express_checkout';
    $storage = $this->get('payum')->getStorage('FrontBundleEntityPayment');
    $payment = $storage->create();
    $payment->setNumber(uniqid());
    $payment->setCurrencyCode('CHF');
    $payment->setTotalAmount(100); // 1.00
    $payment->setDescription('A description');
    $payment->setClientId('anId');
    $payment->setClientEmail('foo@example.com');
    $storage->update($payment);
    $captureToken = $this->get('payum')->getTokenFactory()->createCaptureToken(
        $gatewayName,
        $payment,
        'done' // the route to redirect after capture
    );
    return $this->redirect($captureToken->getTargetUrl());
}
public function doneAction(Request $request)
{
    dump($request);
    $token = $this->get('payum')->getHttpRequestVerifier()->verify($request);
    $gateway = $this->get('payum')->getGateway($token->getGatewayName());
    // You can invalidate the token, so that the URL cannot be requested any more:
    // $this->get('payum')->getHttpRequestVerifier()->invalidate($token);
    // Once you have the token, you can get the payment entity from the storage directly.
    // $identity = $token->getDetails();
    // $payment = $this->get('payum')->getStorage($identity->getClass())->find($identity);
    // Or Payum can fetch the entity for you while executing a request (preferred).
    $gateway->execute($status = new GetHumanStatus($token));
    $payment = $status->getFirstModel();
    // UPDATE SUBSCRIPTION END DATE IN USER ENTITY
    $subscription_end_date = new DateTime("now+ 365 day");
    $subscription_end_date_string = $subscription_end_date->format('Y-m-d H:i:s');
    $user = $this->get('security.token_storage')->getToken()->getUser();
    $user->setSubscriptionEndDate($subscription_end_date);
    $em = $this->getDoctrine()->getManager();
    $em->persist($user);
    $em->flush($user);
    return $this->render('FrontBundle:App:subscription_confirmation.html.twig', [
        'page_title' => 'Accompagnement, coaching de vie personnelle et professionnelle à Genève',
        'subscription_end_date' => $subscription_end_date_string,
    ]);
}

但是我的客户希望他的用户能够在没有任何PayPal帐户的情况下付款(PayPal访客结账(。

好的,

我的现在可以工作了,你只需要设置解决方案类型

鞋底: 买家无需创建PayPal帐户即可结账。这称为PayPal帐户可选。

标记: 买家必须拥有PayPal帐户才能结账。

$payment['SOLUTIONTYPE'] = 'Sole';

在这里查看: https://developer.paypal.com/docs/classic/api/merchant/SetExpressCheckout_API_Operation_NVP/

最新更新