1

我在沙盒上创建了一个企业帐户(除了默认创建为促进者的帐户),并检查了“PayPal Payments Pro”的状态是否为“活动”。使用在 Profile->API Credentials 屏幕中指定的 API 凭证。用户名:sushishPunya_api1.gmail.com

我创建了另一个测试帐户(个人)并使用了 Profile->Funding 屏幕中指定的信用卡详细信息 (4952729234475105, Visa, 4/2018)

当我运行 DoDirectPayment NVP 示例代码(java)时,我收到以下错误:

{"map":{"L_LONGMESSAGE0":"内部错误","VERSION":"86","BUILD":"5908853","L_ERRORCODE0":"10001","AMT":"12.00","ACK" :"失败","CORRELATIONID":"e5808c8712605","TIMESTAMP":"2013-05-09T08:07:36Z","L_SEVERITYCODE0":"错误","L_SHORTMESSAGE0":"内部错误","CURRENCYCODE": “美元”}}


我用以下输入调用它:

(“Sale”、“12”、“Visa”、“4952729234475105”、“042018”、“000”、“Punya”、“AK”、“Elcmanio Real”、“Sunnyvale”、“CA”、“94085”、 “我们”);


这是代码:

/*
 * Copyright 2005, 2008 PayPal, Inc. All Rights Reserved.
 *
 * DoDirectPayment NVP example; last modified 08MAY23. 
 *
 * Process a credit card payment.  
 */
package com.nvp.codegenerator;

import com.paypal.sdk.core.nvp.NVPDecoder;
import com.paypal.sdk.core.nvp.NVPEncoder;
import com.paypal.sdk.profiles.APIProfile;
import com.paypal.sdk.profiles.ProfileFactory;
import com.paypal.sdk.services.NVPCallerServices;
/**
 * PayPal Java SDK sample code
 */
public class DoDirectPayment 
{

    private NVPCallerServices caller = null;

    public NVPDecoder DoDirectPaymentCode(String paymentAction,String amount,String cardType,
                                String acct,String expdate,String cvv2, String firstName,
                                String lastName, String street, String city, String state, 
                                String zip, String countryCode)
    {
        NVPEncoder encoder = new NVPEncoder();
        NVPDecoder decoder = new NVPDecoder();

        try
        {

            caller = new NVPCallerServices();
        APIProfile profile = ProfileFactory.createSignatureAPIProfile();
            /*
             WARNING: Do not embed plaintext credentials in your application code.
             Doing so is insecure and against best practices.
             Your API credentials must be handled securely. Please consider
             encrypting them for use in any production environment, and ensure
             that only authorized individuals may view or modify them.
             */
        // Set up your API credentials, PayPal end point, API operation and version.
            profile.setAPIUsername("sushishPunya_api1.gmail.com");
            profile.setAPIPassword("1366042621");
            profile.setSignature("AFcWxV21C7fd0v3bYYYRCpSSRl31A2VBZp4Zla5Y8mvvCUzzG2TrztxZ");
            /*profile.setAPIUsername("sdk-three_api1.sdk.com");
        profile.setAPIPassword("QFZCWN5HZM8VBG7Q");
        profile.setSignature("AVGidzoSQiGWu.lGj3z15HLczXaaAcK6imHawrjefqgclVwBe8imgCHZ"); */

            profile.setEnvironment("sandbox");
            profile.setSubject("");
            caller.setAPIProfile(profile);

            //encoder.add("VERSION", "86");
            encoder.add("VERSION", "51.0");
            encoder.add("METHOD","DoDirectPayment");

        // Add request-specific fields to the request string.
            encoder.add("PAYMENTACTION",paymentAction);
            encoder.add("AMT",amount);
            encoder.add("CREDITCARDTYPE",cardType);     
            encoder.add("ACCT",acct);                       
            encoder.add("EXPDATE",expdate);
            encoder.add("CVV2",cvv2);
            encoder.add("FIRSTNAME",firstName);
            encoder.add("LASTNAME",lastName);                                       
            encoder.add("STREET",street);
            encoder.add("CITY",city);   
            encoder.add("STATE",state);         
            encoder.add("ZIP",zip); 
            encoder.add("COUNTRYCODE",countryCode);

        // Execute the API operation and obtain the response.
            String NVPRequest = encoder.encode();
            String NVPResponse =(String) caller.call(NVPRequest);
            decoder.decode(NVPResponse);
            String strAck = decoder.get("ACK");
            String trasID = decoder.get("TRANSACTIONID");
            System.out.println("trasID");
            if(strAck !=null && !(strAck.equals("Success") || strAck.equals("SuccessWithWarning"))) {
                // do error processing
                  System.out.println("\n########## CreateRecurringPaymentsProfile call failed ##########\n");
            } else {

                //success
                 System.out.println("\n########## CreateRecurringPaymentsProfile call passed ##########\n");
            }

        } catch(Exception ex)
        {
            ex.printStackTrace();
        }
        return decoder;
    }

}

知道出了什么问题吗?

谢谢,普尼亚

4

0 回答 0