用于发布到返回 url 的 PayPal 支付变量

标签 paypal paypal-ipn

我目前正在使用 PayPal 通过 API 进行支付,如下所示:

<form id="payment" method="post" action= "https://www.sandbox.paypal.com/cgi-bin/webscr">
    <input type="hidden" name="cmd" value="_xclick">
    <input type="hidden" name="currency_code" value="USD">
    <input type="hidden" name="business" value="xxx@yahoo.com">
    <input type="hidden" name="item_name" value="Order">
    <input type="hidden" name="amount" value="1.00">
    <input type="hidden" name="return" value="http://www.example.com/callback" />
    <input type='hidden' name='rm' value='2'>
</form>

https://developer.paypal.com/webapps/developer/docs/classic/paypal-payments-standard/integration-guide/Appx_websitestandard_htmlvariables/#id08A6HI0709B 所述, rm 设置为 2 以在支付过程后使用 POST 方法返回 url。

然而,返回的 POST 变量没有详细描述,我从 chrome 中得到了一些变量,比如:

mc_gross:1.00
mc_currency:USD

这很容易理解。但是变量如下:

verify_sign:AIcINKz4gusKUvaiOqo3JiAvlEBFA-7ApBee-2bb5OtUUM5RhVUumd84
auth:AEH3nN1f7cUPFUFS4wPBRv6gOw6CV0BppygOu6y-vRHspA3a-ae-y2BnH1tQds1bwOG4EFqxZrcgNxLXKZdsDWg

我没弄明白是什么意思。可能这应该像加密或校验和?如果是,我如何检查这些返回变量的有效性?

最佳答案

这是 Paypal 付款方式的示例。

PayPalPayment *payment = [[PayPalPayment alloc] init];

payment.amount = [self.paymentAmount decimalNumberByRoundingAccordingToBehavior:roundUp];

payment.currencyCode = @"USD";

self.PayPalReceiverEmail = [[self.photo objectForKey:kPAPPhotoUserKey] objectForKey:kPayPalReceiverEmailKey];

payment.shortDescription = self.PayPalReceiverEmail;

if (([[NSDecimalNumber notANumber] isEqualToNumber:payment.amount] ) ) {
// This particular payment will always be processable. If, for
// example, the amount was negative or the shortDescription was
// empty, this payment wouldn't be processable, and you'd want
// to handle that here.
  UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Please enter a valid amount" message:nil delegate:nil cancelButtonTitle:nil otherButtonTitles:@"Dismiss", nil];
  [alert show];

}
else {
if  (!payment.processable)
{
    UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Payment cannot be processed. Please contact technical support." message:nil delegate:nil cancelButtonTitle:nil otherButtonTitles:@"Dismiss", nil];
    [alert show];
}
else
{
// Any customer identifier that you have will work here. Do NOT use a device- or
// hardware-based identifier.
//self.customerId = @"user-12345";
  self.customerId = [PFUser currentUser].objectId;

// Set the environment:
// - For live charges, use PayPalEnvironmentProduction (default).
// - To use the PayPal sandbox, use PayPalEnvironmentSandbox.
// - For testing, use PayPalEnvironmentNoNetwork.
[PayPalPaymentViewController setEnvironment:self.environment];


  if (self.PayPalReceiverEmail && self.PayPalReceiverEmail.length >0 )
  {
      PayPalPaymentViewController *paymentViewController;

      if (self.PayPalClientId && self.PayPalClientId.length > 0)
      {


   paymentViewController = [[PayPalPaymentViewController alloc] initWithClientId:self.PayPalClientId
                                                                                               receiverEmail:self.PayPalReceiverEmail
                                                                                                     payerId:self.customerId
                                                                                                     payment:payment
                                                                                                    delegate:self];

          paymentViewController.hideCreditCardButton = !self.acceptCreditCards;

            }
    else
    {

       paymentViewController = [[PayPalPaymentViewController alloc] initWithClientId:kPayPalClientId
                                                                                                     receiverEmail:self.PayPalReceiverEmail
                                                                                                           payerId:self.customerId
                                                                                                           payment:payment
                                                                                                          delegate:self];

        paymentViewController.hideCreditCardButton = YES;

    }

// Setting the languageOrLocale property is optional.
//
// If you do not set languageOrLocale, then the PayPalPaymentViewController will present
// its user interface according to the device's current language setting.
//
// Setting languageOrLocale to a particular language (e.g., @"es" for Spanish) or
// locale (e.g., @"es_MX" for Mexican Spanish) forces the PayPalPaymentViewController
// to use that language/locale.

// For full details, including a list of available languages and locales, see PayPalPaymentViewController.h.
paymentViewController.languageOrLocale = @"en";


[self presentViewController:paymentViewController animated:YES completion:nil];

关于用于发布到返回 url 的 PayPal 支付变量,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33378346/

相关文章:

Paypal 订阅 : Adjustment of the amount on revised plan

php - urldecode() 不解码 + 号

Paypal 商户帐户可防止多个计费协议(protocol)

php - 无法在 SSL 网站上使用 Paypal API

Paypal 沙箱 IPN 不发送请求

google-apps-script - 使用 Google Apps 脚本管理 Paypal IPN

php - 调用 DoDirectPayment 时出现权限错误 - PayPal

ruby-on-rails - Paypal自适应支付IPN回调: how to return the complete unaltered ipn message

node.js - 使用 node.js 进行 Paypal IPN 验证 - express 应用程序

PHP:如何检查响应代码?