How to refund the payment using Paypal in ios? - ios

I am using paypal native sdk , in this there is no concept of refund payment. For this do we need REST API's? If we use REST API's then we need to get transaction id. How can we achieve this?
Thanks , Suggestions are really appreciated.

It has to be implemented with your server-side APIs (PayPal REST API - Refund a Sale).
A payment ID will be returned in the JSON response when your app makes a successful payment with a PayPal Mobile SDK.
Your app communicates with your server and sends the ID to your server
Your server can store the payment id value in a database, and look up the payment resource with a GET request to the payment uri, this is also to verify the mobile payment (by checking serveral fields in the response)
The JSON response will contain a Sale object in related_resources, with "state": "completed", obtain the sale id, which will be used in the refund call
Make the refund API call, with the sale id from step#4
Reference links:
Verify a mobile payment
Refund API reference

Related

Paypal restful apis canada, Not able to create app on developer.paypal.com

I have one mobile application. In which we have payment function. In our application we have below mentioned payment flow.
User can add credit card, For this first we are calling Paypal api (https://api.sandbox.paypal.com/v1/oauth2/token) to get token. As we got token then we are calling api (https://api.sandbox.paypal.com/v1/vault/credit-card) to get credit card details form paypal.
We are sending response details to our server. Our server will store that response.
Later from application if user want to pay then we are showing list of added card & user can select any of card.
We are sending card id to our server & based on stored details our server call charge api of paypal for charge.
Till now we are using sandbox account which belongs to USA. But Now we want to create live app on paypal & for this we are using our original account which belongs to Canada. But in create app section on developer.paypal.com we are not able to create application.
- Is this function of payment is not available in Canada ? If not then Please let us know how we can achieve it ?
- Is there any alternate exists for above mentioned payment function ?
Please let us know how we can create app and get clientid & secret for above mentioned payment function .
Thanks :)
REST API in PayPal for Credit Card is only allowable in US and UK Pro. Other country is not yet available.
Further information in here.

How to do payment using stripe

I am using Stripe to make payment in my application. I got the token Successfully.
I want to know that how the charges will be done, as there is no changes reflected in my Stripe dashboard. I'm using my Stripe Account TestPublish Key.
Tokens only represent a card or payment method, not an actual transaction.
Once you've collected and tokenized a customer's payment information, you need to send the token to your backend server so you can use it in an API request, e.g. a charge creation request or customer creation request.
You can find more information in this tutorial: https://stripe.com/docs/charges
Common error - you need to test on a real device, not the simulator. Just one of the gotchas of the Stripe API.

Future payment with iOS Stripe SDK

Using the iOS SDK for Stripe, can we do the following
Create a customer profile where the customer id can be sent and stored to the backend
Add, edit, delete credit cards to the customer profile
Card can be charged automatically from the backend
Note that, once the user make a payment via stripe, we ask them to allow auto-payment next time the balance goes below a certain level. So, it is not periodic subscription. But it is a permission in advance, to charge later.
For a single payment, the SDK takes the card info and provides the token. Token passed to server where the payment is finally process. This looks very nice and secured.
I do not want to store the card info in the iOS app, also not in server. But does stripe take the responsibility to store it and allow the backend to charge it later? I need a way so that server can communicate with stripe with a unique id and amount, so that stripe accepts the request and make the payment.
You can ask for webservice to your webservice developer which can make APIs to create customers in stripe account and store its customer_id in database so for next all payment you can make payment using customer id. Stripe will store card details in its database so no need to store card details at our side.

How to Verify Paypal Account via REST API

In my iOS application i am using paypal, so, when user going through signup process i need to verify his paypal account is vaild or not.
i am using the rest API but didn't see any API related to this.
Still there is no way in REST API's to check the validity of a PayPal account by just providing the email address and name .As of now it can only be done using "GetVerifiedStatus" classic API .
https://developer.paypal.com/docs/classic/api/adaptive-accounts/GetVerifiedStatus_API_Operation/

Active merchant and Paypal API for recurring payment

I have few questions on paypal's recurring payments, I went trough the paypal documentation to find some answers but, it didn't help me much.
Here are the stuffs that I need to know, hope someone can help me on these.
I'm using paypal's standard payment account. So far I managed to create recurring payments with paypal by posting NVP's to paypal from merchant website to paypal.
Now I need to show recurring payment profiles on merchant web site. So that customers can cancel, modify recurring payments from merchant website without redirecting to paypal.Is this possible?
Think I should use paypal's SOAP API for this as I can't get the job done with NVP API. So I installed active merchant as described in this post. But I always get an error
This transaction is invalid. Please
return to the recipient's website to
complete your transaction using their
regular checkout flow.
from paypal and it never send me the token back.
Also I got this on my log
Security header is not
valid
Is it because I use sandbox API credentials or is it because I can't use paypal's standard account with SOAP API?
Usually the "security header is not valid" response comes from using sandbox credentials in the live environment or vice-versa. AM will use the sandbox when your Rails app is in development mode, so be sure you are using the right set of credentials.
When I was integrating PayPal's recurring payment profiles into the SaaS Rails Kit (using ActiveMerchant) I ended up just canceling a user's current profile and creating a new one when they wanted to change their subscription.

Resources