Skip to content

[WIP] feat: Add PayPal payment configuration #1813

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from

Conversation

liveHarshit
Copy link
Member

Fixes #333

if (paymentConfirmation != null) {
val paymentInfo = paymentConfirmation.toJSONObject()
Timber.d(paymentInfo.toString(4))
// TODO: Send token to server and redirect to tickets
Copy link
Member Author

@liveHarshit liveHarshit May 22, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@iamareebjamal I need help here. I'm getting following response -

{
                        "client": {
                            "environment": "sandbox",
                            "paypal_sdk_version": "2.16.0",
                            "platform": "Android",
                            "product_name": "PayPal-Android-SDK"
                        },
                        "response": {
                            "create_time": "2018-12-30T19:59:20Z",
                            "id": "PAY-0JW58086WS3706240LQUSHEQ",
                            "intent": "sale",
                            "state": "approved"
                        },
                        "response_type": "payment"
                    }

And according to api documentation for paypal payment request -

Request

Body
{
  "data": {
    "attributes": {
      "return_url": "https://localhost:5000/return_url",
      "cancel_url": "https://localhost:5000/cancel_url"
    },
    "type": "paypal-payment"
  }
}

How to send confirmation token to the server?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are you using Braintree SDK?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, It's PayPal Android SDK.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will see

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@liveHarshit from what I understand, the server already implements everything it needs, for now, For a Paypal payment, 2 things are needed: A Payer ID and A Payment ID. The Payment ID is generated by the server and I can see that you can get it from PaymentConfirmation above. For Payer ID, please check if you can generate it with the Paypal SDK, probably there should be a Paypal button for the user to log in or some similar method. After you have the Payer ID and the Payment ID, send a Charge object to the server. I think it should work, I will try Paypal SDK for Android to see if I understand it correctly

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, it is the ID of who pay the payment, and it is unchanged while for PayPal user email or relevant information can be changed

Copy link
Member Author

@liveHarshit liveHarshit Jun 29, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we should Braintree. As PayPal andorid SDK is already Deprecated and suggesting for Braintree.
Read comments in this question: https://stackoverflow.com/questions/38229929/getting-the-payerid-from-paypal-android-sdk

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As it is configured on the server, I don't think we can use it on Android. It is configured to accept approval url.
https://github.com/paypal/PayPal-node-SDK/issues/24

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

let's me spend a bit more time on this and then we can discuss what solution should we go on this tomorrow meeting, besides, I also think Braintree is better as the old documentation is deleted

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I also think Braintree is better as the old documentation is deleted

Exactly, that is the problem. PayPal has deleted the documentation related to that and archive the sdk repo.

@liveHarshit
Copy link
Member Author

Issue: fossasia/open-event-server#5961

@liveHarshit liveHarshit added the on hold: server side Needs to solve on the server first label Jun 22, 2019
@liveHarshit
Copy link
Member Author

liveHarshit commented Jul 6, 2019

I just found a blog which writes about PayPal server authentication with android.
@anhanh11001 Can we make payment with authorization_code and client id:
I will send the test response soon.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
on hold: server side Needs to solve on the server first work in progress
Projects
None yet
Development

Successfully merging this pull request may close these issues.

add paypal
3 participants