Skip to content

Conversation

@sonntag-philipp
Copy link
Contributor

@sonntag-philipp sonntag-philipp commented Oct 1, 2024

Description

This PR introduces a PayPal payments plugin based on the PayPal Orders Api with a 2 step flow as specified in the Vendure documentation.

The main purpose of this plugin is to offer the user a solution where PayPal can be used directly without a step in between.

Documentation will be added by me before this plugin is merged. Just want to make sure I don't have to change it after review feedback of the implementation.

Breaking changes

I am not able to determine a breaking change. The implemented features represent new functionality and should have no effect on existing implementations.

Overview

  • Only supports 2 step payments
  • Dev server contains ui that can be used to test payments
  • A single mutation is added to create PayPal orders
  • Integration and unit tests were added and should cover most of the functionality

Screenshots

Checklist

📌 Always:

  • I have set a clear title
  • My PR is small and contains a single feature
  • I have checked my own PR

👍 Most of the time:

  • I have added or updated test cases
  • I have updated the README if needed

@vercel
Copy link

vercel bot commented Oct 1, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated (UTC)
docs ✅ Ready (Inspect) Visit Preview Nov 15, 2024 0:44am

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'm not quite sure if most of the maintainers use WebStorm, but this makes it way easier to execute a specific test file in VSCode.

Also had to make some changes to the get-package-dir to make it work not only for the e2e within the payments-plugin.

});

// eslint-disable-next-line no-console
console.log('Auth Token: ', shopClient.getAuthToken());
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This token is printed, so we can enter it in the Web UI of the paypal plugin. I would be open to setting this automatically in the Vendure REST Endpoint, but I wasn't quite sure how.

}

// @ts-ignore
function html(strings, ...values) {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Well. I know we shouldn't integrate code only for syntax highlighting, but as this isn't code of the library itself and only exists for testing purposes, one could argue that it's still okay.
Especially as it doesn't require additional dependencies.

@sonntag-philipp
Copy link
Contributor Author

I still have to implement the idempotency headers supported by the PayPal Api, even though it already works without them. This could also be done is a future PR.

@sonntag-philipp sonntag-philipp changed the title feature(payments-plugin): Create PayPal integration without Braintree feature(payments-plugin): PayPal two-step flow implementation Oct 10, 2024
@sonntag-philipp sonntag-philipp marked this pull request as ready for review October 10, 2024 14:12
Comment on lines 28 to 33
if (!sessionOrder) {
throw new IllegalOperationError('Session has no active order');
}
if (sessionOrder.state !== 'ArrangingPayment') {
throw new IllegalOperationError('Order must be in arranging payment state');
}
Copy link
Contributor

@DanielBiegler DanielBiegler Oct 13, 2024

Choose a reason for hiding this comment

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

I think these could be internationalized with existing error message for example there are:

    "NO_ACTIVE_ORDER_ERROR": "There is no active Order associated with the current session",

and

    "ORDER_MODIFICATION_ERROR": "Order contents may only be modified when in the \"AddingItems\" state",
    "ORDER_PAYMENT_STATE_ERROR": "A Payment may only be added when Order is in \"ArrangingPayment\" state",
    "ORDER_STATE_TRANSITION_ERROR": "Cannot transition Order from \"{ fromState }\" to \"{ toState }\"",

Might be good to take a second pass over all thrown errors and see what can be internationalized and reused.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Really good feeback, thank you :) Will definetly do that!

@sonntag-philipp sonntag-philipp changed the base branch from master to minor October 14, 2024 16:00
@sonntag-philipp sonntag-philipp force-pushed the feature/payments-plugin-paypal branch from a46fc50 to 3674cc2 Compare October 14, 2024 16:07
@sonntag-philipp sonntag-philipp force-pushed the feature/payments-plugin-paypal branch from 3674cc2 to cda6f72 Compare October 14, 2024 16:15
@sonntag-philipp
Copy link
Contributor Author

Renamed the commit messages to fit other scopes and rebased on minor branch.

@sonarqubecloud
Copy link

Quality Gate Failed Quality Gate failed

Failed conditions
25.3% Duplication on New Code (required ≤ 3%)

See analysis details on SonarQube Cloud


return (await response.json()) as PayPalOrderInformation;
} catch (error: any) {
const message = 'error.paypal-authorization-details-failed';
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Even though SonarQube already mentioned this code is often duplicated, I want to make sure that errors are correctly handled this way in Vendure. Maybe you guys have some feedback on this :)

@sonntag-philipp
Copy link
Contributor Author

I've added a small documentation on how to get started using this plugin. Reviews are welcome right now :)

@michaelbromley @taxilian

@dfernandesbsolus
Copy link
Contributor

dfernandesbsolus commented Jun 4, 2025

@michaelbromley @sonntag-philipp Hey guys, is this pr outdated? This plugin would be a great complement to Braintree which is not available in many countries.

@michaelbromley
Copy link
Member

Hi @sonntag-philipp - apologies for the long time with no response on this. We'd be interested in getting this merged for the next minor release, v3.4. The conflicts look rather minor, would you have a bit of time to get that resolved?

If not, let me know and one of us can take that on.

@sonntag-philipp
Copy link
Contributor Author

@michaelbromley Oh, I thought the PR was "dismissed" (or something like that) so I moved the PayPal package to my local workspace (without relevant changes) :D

I don't have much time until at least Monday, so I could fix the conflicts until Tuesday next week. If you need it more early for the 3.4 minor release, feel free to work on that :)

@michaelbromley
Copy link
Member

@sonntag-philipp there's no rush on this. We're looking around the end of June for the 3.4 release.

No, the PR was not dismissed - we just dropped the ball on the communication front with all the things we have going on.

@sonntag-philipp
Copy link
Contributor Author

Sorry guys, I have to meet a deadline on another project. This PR has to wait some more time.

Just the merge would not be the problem, but I think I do not I will be able to respond somewhat fast on issues that occur when this plugin is used.

At least until the end of july I will not be able to spend much time on this.

@michaelbromley

},
compatibility: '^3.0.0',
adminApiExtensions: {
schema: shopSchemaExtensions,
Copy link
Contributor

Choose a reason for hiding this comment

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

isn't the shop and admin schema swapped here?

Copy link
Collaborator

Choose a reason for hiding this comment

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

true! good catch

@github-project-automation github-project-automation bot moved this from 👀 Under consideration to ♻️ In progress in Vendure OS Roadmap Aug 20, 2025
@dlhck dlhck added this to the v3.6.0 milestone Aug 22, 2025
@dlhck dlhck removed this from the v3.6.0 milestone Aug 26, 2025
@dlhck
Copy link
Collaborator

dlhck commented Nov 3, 2025

@sonntag-philipp I would really like to get this PR merged as it is a great improvement. Do you know if you can spend some more time to finish this? Please let me know.

@larsdecker
Copy link

Any news on this topic? It would be really good to see a Paypal Integration in Vendure.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

10 participants