ITsolutionWizard
asked on
Paypal API
I use this webpage to code the PayPal API https://tutorials.tinyappco.com/ASPNET/PayPal,
and some issues below.
1. When it runs, and alert about this (var createdPayment = payment.Create(apiContext) ; )
and return ( The remote server returned an error: (400) Bad Request. ). But I can see the API data into the Paypal already. how to fix it?
2. In Paypal, do you know how to code for Auth. only meaning that just want to hold the fund e.g. security deposit for 500.00. But not charge.
I follow this example (https://tutorials.tinyappco.com/ASPNET/PayPal)
and some issues below.
1. When it runs, and alert about this (var createdPayment = payment.Create(apiContext)
and return ( The remote server returned an error: (400) Bad Request. ). But I can see the API data into the Paypal already. how to fix it?
2. In Paypal, do you know how to code for Auth. only meaning that just want to hold the fund e.g. security deposit for 500.00. But not charge.
I follow this example (https://tutorials.tinyappco.com/ASPNET/PayPal)
protected void Page_Load(object sender, EventArgs e)
{
//https://stackoverflow.com/questions/30095448/paypal-rest-api-with-credit-cart-payment-method
//https://tutorials.tinyappco.com/ASPNET/PayPal
#region Authenticate with PayPal
var config = ConfigManager.Instance.GetProperties();
var accessToken = new OAuthTokenCredential(config).GetAccessToken();
var apiContext = new APIContext(accessToken);
#endregion
//var apiContext = GetApiContext(clientId, clientSecret);
CreditCard creditCard = new CreditCard();
creditCard.number = " XXXXXXXXXXXXXXXX";
creditCard.type = "Visa";
creditCard.expire_month = 08;
creditCard.expire_year = 2021;
creditCard.cvv2 = "145";
creditCard.first_name = "Ric";
creditCard.last_name = "Chan";
Amount amount = new Amount();
amount.total = "7.47";
amount.currency = "USD";
Transaction transaction = new Transaction();
transaction.amount = amount;
transaction.description = "This is the payment transaction description.";
List<Transaction> transactions = new List<Transaction>();
transactions.Add(transaction);
FundingInstrument fundingInstrument = new FundingInstrument();
fundingInstrument.credit_card = creditCard;
List<FundingInstrument> fundingInstruments = new List<FundingInstrument>();
fundingInstruments.Add(fundingInstrument);
Payer payer = new Payer();
payer.funding_instruments = fundingInstruments;
payer.payment_method = "credit_card";
var redirectUrls = new RedirectUrls();
redirectUrls.return_url = "Default.aspx";
Payment payment = new Payment();
payment.intent = "sale";
payment.payer = payer;
payment.transactions = transactions;
//payment.redirect_urls = redirectUrls;
var createdPayment = payment.Create(apiContext);
//Response.Write(createdPayment.state);
//Payment createdPayment = payment.Create(apiContext);
Response.Write("Payment ID " + payment.id);
}
ASKER
No one here?
ASKER CERTIFIED SOLUTION
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
CreditCard creditCard = new CreditCard();
creditCard.number = " XXXXXXXXXXXXXXXX";
creditCard.type = "Visa";
creditCard.expire_month = 08;
creditCard.expire_year = 2021;
creditCard.cvv2 = "145";
creditCard.first_name = "Ric";
creditCard.last_name = "Chan";
Amount amount = new Amount();
amount.total = "7.47";
amount.currency = "USD";
WHY are using CC data in your code.. one of the reasons for using pypal for the user is for you (the vendor) to NOT get this information. Test your code using your developer.paypal.com account and settings until you get things right.
ASKER
Can you just focus on what ask for help?
I use cc because I need to
Thanks
I use cc because I need to
Thanks
work through the example at this link that I gave before: https://developer.paypal.com/docs/api/quickstart/capture-payment/
Once you capture/store the CC information you are subject to PCI compliance.
Why do you think that you need to capture this information if using paypal or other payment provider I.e. stripe, square, google pay, apple pay, Visa Direct, et al. You don't need it and it is actually hidden from you the vendor.
I'm trying to be helpful here.. yes the payment processor does collect a commission but they reduce your risk and liability considerably. Many large companies have had breaches and the legal liability is minor compared to their loss of reputation in the industry.
no where in the example that I provided the link to do you pass the cc information to paypal have the CC info.. you pass a bunch of parameters to paypal, and hand the customer off to paypal and you either get an accepted or declined response.
Are you testing using the paypal sandbox?
Once you capture/store the CC information you are subject to PCI compliance.
Why do you think that you need to capture this information if using paypal or other payment provider I.e. stripe, square, google pay, apple pay, Visa Direct, et al. You don't need it and it is actually hidden from you the vendor.
I'm trying to be helpful here.. yes the payment processor does collect a commission but they reduce your risk and liability considerably. Many large companies have had breaches and the legal liability is minor compared to their loss of reputation in the industry.
no where in the example that I provided the link to do you pass the cc information to paypal have the CC info.. you pass a bunch of parameters to paypal, and hand the customer off to paypal and you either get an accepted or declined response.
Are you testing using the paypal sandbox?
ASKER
Yes I test with sandbox
I asked how to solve the code problem
That generate the issue
Can u help?
I asked how to solve the code problem
That generate the issue
Can u help?
ASKER
Any one can help?
ASKER