Subscription without PayPal Account using credit/debit card
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi I am working on a Integrating paypal in our web application so that users can subscribe to our subscription plans.
Let me tell you what I have done so far.
I created a rest app and using the ClientId and ClientSecret of the rest app I was able to
1.Creat a plan
2. Activate the plan
3.Create the Agreement and I got a url for confirmation and after confirmation I was able to create a subscription . But this process works only for users who have paypal account.
I contacted the Merchant Technical Support regarding this . But I was not able get the exact solution.
Some solutions provided by the MTS
1. Enhanced Recurring Payment
2.Enabling Paypal Payment Pro
I have already created a rest app and I was able to create the subscription, but according to MTS I dont have to create a rest app , I am confused here and I need to know what exact integration I should go ahead with.
I will also paste the java code which I have implemented so far.
try{
Plan plan = new Plan();
plan.setId("P-51X5509888001534KW7C3GMI");
Agreement agreement = new Agreement();
agreement.setPlan(plan);
agreement.setName("Orion Agreement");
agreement.setDescription("Plan creation Agreement");
agreement.setStartDate("2019-08-01T00:00:01Z");
//Now Create an object of credit card and add above details to it
//Address for the payment
Address billingAddress = new Address();
billingAddress.setCity("Los Angeles");
billingAddress.setCountryCode("US");
billingAddress.setLine1("Aplha street line 1");
billingAddress.setLine2("Beta street line 2");
billingAddress.setPostalCode("9001");
billingAddress.setState("California");
CreditCard card = new CreditCard();
card.setBillingAddress(billingAddress);
card.setCvv2("123");
card.setExpireMonth(9);
card.setExpireYear(2021) ;
card.setFirstName("Red");
card.setLastName("John");
card.setNumber("2221000000000009");
card.setType("mastercard");
// Now we need to specify the FundingInstrument of the Payer
// for credit card payments, set the CreditCard which we made above
FundingInstrument fundInstrument = new FundingInstrument();
fundInstrument.setCreditCard(card);
// The Payment creation API requires a list of FundingIntrument
List<FundingInstrument> fundingInstrumentList = new ArrayList<>();
fundingInstrumentList.add(fundInstrument);
Payer payer = new Payer();
payer.setPaymentMethod("credit_card");
payer.setFundingInstruments(fundingInstrumentList);
agreement.setPayer(payer);
ShippingAddress shippingAd = new ShippingAddress();
shippingAd.setLine1("111 First Street");
shippingAd.setCity("Saratoga");
shippingAd.setState("CA");
shippingAd.setPostalCode("95070");
shippingAd.setCountryCode("US");
Agreement agreementPlan = null;
try {
agreementPlan = agreement.create(apiContext);
} catch (Exception e) {
// TODO Auto-generated catch block
log.info("setupPlan error - " + e.toString());
e.printStackTrace();
}
response.put("redirectURL", agreementPlan);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I am also adding the response which I got
Hi William,
--header "User-Agent:PayPalSDK/ (v=1.8.0_171; vendor=Oracle Corporation; bit=64; os=Windows_10 10.0)" \
--header "PayPal-Request-Id:9d8ca027-e841-47c7-b3d1-37f714fd71df" \
--header "Accept:application/json" \
--header "Content-Type:application/json" \
--data '{
"name": "Orion Agreement",
"description": "Plan creation Agreement",
"start_date": "2019-08-01T00:00:01Z",
"payer": {
"payment_method": "credit_card",
"funding_instruments": [
{
"credit_card": {
"number": "2221000000000009",
"type": "mastercard",[Removed. Phone #s not permitted]p; "expire_year": 2021,
"cvv2": "123",
"first_name": "Red",
"last_name": "John",
"billing_address": {
"line1": "Aplha street line 1",
"line2": "Beta street line 2",
"city": "Los Angeles",
"country_code": "US",
"postal_code": "90001",
"state": "California"
}
}
}
]
},
"plan": {
"id": "P-51X5509888001534KW7C3GMI"
}
}'
"details":[{"field":"unauthorized_access","issue":"You don't have permission to access this resource."}],"message":"You don't have permission to access this resource.","information_link":"https://developer.paypal.com/docs/api/payments.billing-agreements#errors","debug_id":"89ae2ddd62ad9"}
"field": "unauthorized_access",
"issue": "You don\u0027t have permission to access this resource."
}] debug-id: 89ae2ddd62ad9 information-link: https://developer.paypal.com/docs/api/payments.billing-agreements#errors
response-code: 401 details: name: UNAUTHORIZED_ACCESS message: You don't have permission to access this resource. details: [{
"field": "unauthorized_access",
"issue": "You don\u0027t have permission to access this resource."
}] debug-id: 89ae2ddd62ad9 information-link: https://developer.paypal.com/docs/api/payments.billing-agreements#errors
at com.paypal.base.rest.PayPalRESTException.createFromHttpErrorException(PayPalRESTException.java:72)
at com.paypal.base.rest.PayPalResource.execute(PayPalResource.java:431)
at com.paypal.base.rest.PayPalResource.configureAndExecute(PayPalResource.java:295)
at com.paypal.base.rest.PayPalResource.configureAndExecute(PayPalResource.java:228)
at com.paypal.api.payments.Agreement.create(Agreement.java:145)
at com.infomatics.orion.web.controller.PayPalController.createAgreement(PayPalController.java:192)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.springframework.web.method.support.InvocableHandlerMethod.doInvoke(InvocableHandlerMethod.java:205)
at org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:133)
at org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:97)
at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandlerMethod(RequestMappingHandlerAdapter.java:849)
at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:760)
at org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:85)
at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:967)
at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:901)
at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:970)
at org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:872)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:648)

Haven't Found your Answer?
It happens. Hit the "Login to Ask the community" button to create a question for the PayPal community.
- where does paypal payments go to if there is no linked phone or email to the seller ? in PayPal Payments Standard
- Couldn't receive International payment in PayPal Payments Standard
- Sandbox account collect billing and shipping address in Sandbox Environment
- "System error. Please try again later" when connecting to paypal sandbox account with my android app in Sandbox Environment
- [WooCommerce PayPal Payments] - Required phone country code, different than the cards country code. in PayPal Payments Standard