Skip to content

paypal-examples/svelte-paypal-js

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Svelte App PayPal Integration

A sample app demonstrating the use of paypal-js to add PayPal buttons to a simple Svelte app.

This is project is based on the starter svelte template that lives at https://github.com/sveltejs/template.

Get started

Install the dependencies...

cd svelte-integration
npm install

...log in to the developer dashboard and get your client ID from your default application. Change const CLIENT_ID = 'your-client-id'; in src/Checkout.svelte so CLIENT_ID matches your sandbox client ID...

If you need help setting up your developer dashboard or finding your client ID, follow the first step in the getting started documentation to get API credentials

...then start Rollup:

npm run dev

Navigate to localhost:5000. You should see the app running.

How It Works

The JavaScript SDK is imported via paypal-js in src/Checkout.svelte where we set up a div to hold the buttons. Style, payment method, and other options can be specified in paypal.Buttons()

For more details and configuration options look at paypal-js usasge and the PayPal JavaScript SDK Complete Reference

About

Learn how to integrate paypal-js with svelte

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published