Giter VIP home page Giter VIP logo

adyen-python-online-payments's Introduction

Adyen online payment integration demos

Run this integration in seconds using Gitpod

NOTE: To allow the Adyen Drop-In and Components to load, you have to add https://*.gitpod.io as allowed origin for your chosen set of API Credentials

Open in Gitpod
 First time with Gitpod?

Details

This repository showcases a PCI-compliant integration of the Sessions Flow, the default integration that we recommend for merchants. Explore this simplified e-commerce demo to discover the code, libraries and configuration you need to enable various payment options in your checkout experience.

Card Checkout Demo

The Demo leverages Adyen's API Library for Python GitHub | Docs.

Requirements

  • Python 3.5 or greater
  • Python libraries:
    • flask
    • uuid
    • Adyen v8.0.0 or higher

Installation

  1. Clone this repo
git clone https://github.com/adyen-examples/adyen-python-online-payments.git
  1. Run source ./setup.sh to:

    • Create and activate a virtual environment
    • Download the necessary python dependencies
  2. Create a .env file with all required configuration

Remember to include http://localhost:8080 in the list of Allowed Origins

    PORT=8080
    ADYEN_API_KEY="your_API_key_here"
    ADYEN_MERCHANT_ACCOUNT="your_merchant_account_here"
    ADYEN_CLIENT_KEY="your_client_key_here"
    ADYEN_HMAC_KEY="your_hmac_key_here"

Usage

  1. Run ./start.sh to:

    • Initialize the required environment variables. This step is necessary every time you re-activate your venv
    • Start Python app
  2. Visit http://localhost:8080 and select an integration type.

To try out integrations with test card numbers and payment method details, see Test card numbers.

Webhooks

Webhooks deliver asynchronous notifications about the payment status and other events that are important to receive and process. You can find more information about webhooks in this blog post.

Webhook setup

In the Customer Area under the Developers → Webhooks section, create a new Standard webhook.

A good practice is to set up basic authentication, copy the generated HMAC Key and set it as an environment variable. The application will use this to verify the HMAC signatures.

Make sure the webhook is enabled, so it can receive notifications.

Expose an endpoint

This demo provides a simple webhook implementation exposed at /api/webhooks/notifications that shows you how to receive, validate and consume the webhook payload.

Test your webhook

The following webhooks events should be enabled:

  • AUTHORISATION

To make sure that the Adyen platform can reach your application, we have written a Webhooks Testing Guide that explores several options on how you can easily achieve this (e.g. running on localhost or cloud).

adyen-python-online-payments's People

Contributors

deepu105 avatar dependabot[bot] avatar gcatanese avatar jlengrand avatar katie-shields avatar kwok-he-chu avatar tddouglas avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

adyen-python-online-payments's Issues

uuid not pip installable

I have had an issue where I was not able to install uuid via pip install... however, I was able to remove the uuid line from requirements.txt, and everything was then completely fine when running the the setup.sh. It appears uuid may be included with Python anyway.

The error from setup.sh:

Could not find a version that satisfies the requirement uuid==1.30 (from -r requirements.txt (line 3)) (from versions: )
No matching distribution found for uuid==1.30 (from -r requirements.txt (line 3))

Sample fails for Klarna method

Trying to proceed with a Klarna checkout fails for the sample, with the following error:

adyen-implementation.js:76 NETWORK_ERROR No InvoiceLines provided [This error message is only provided on TEST, this error will be a 500 Internal Error on LIVE.] NETWORK_ERROR: No InvoiceLines provided [This error message is only provided on TEST, this error will be a 500 Internal Error on LIVE.]
    at yB (https://checkoutshopper-test.adyen.com/checkoutshopper/sdk/5.23.1/adyen.js:1:176298)
    at https://checkoutshopper-test.adyen.com/checkoutshopper/sdk/5.23.1/adyen.js:1:175818
    at u (https://checkoutshopper-test.adyen.com/checkoutshopper/sdk/5.23.1/adyen.js:1:38360)
    at Generator._invoke (https://checkoutshopper-test.adyen.com/checkoutshopper/sdk/5.23.1/adyen.js:1:38148)
    at Generator.next (https://checkoutshopper-test.adyen.com/checkoutshopper/sdk/5.23.1/adyen.js:1:38768)
    at Dd (https://checkoutshopper-test.adyen.com/checkoutshopper/sdk/5.23.1/adyen.js:1:27464)
    at i (https://checkoutshopper-test.adyen.com/checkoutshopper/sdk/5.23.1/adyen.js:1:27658) r {_id: 'klarna-db9ebbba-fb74-4eb9-9805-b5ad62303a39', props: {…}, state: {…}, _node: div#component.payment, _component: {…}, …}

[BUG] Reference string length causes GrabPay Test Transaction to fail


name: 🐞 Bug
about: File a bug/issue
title: '[BUG] Reference string length causes GrabPay Test Transaction to fail'


Recommendation

The docs indicates a maximum string length of 80 for reference parameter. When reference length is replaced with a shorter string, GrabPay Drop-in works as expected.

Screenshot 2023-03-21 at 11 06 01 AM

Current Behavior:

Selecting GrabPay Drop-in option on GitPod instance returns a 422 error with message: "reference='Reference 0e852a1a-f187-49e9-9092-221772cbd46c' given is invalid.

Expected Behavior:

Selecting GrabPay Drop-in option on GitPod instance should redirect user to weblogin.grab.com to authenticate user and continue with checkout flow.

Steps To Reproduce:

  1. Create test merchant account on Customer Area
  2. Add GrabPay_SG payment method to test merchant account
  3. Open ./app/main/sessions.py file
  4. Change request['amount'] = {"value": "10000", "currency": "EUR"} to request['amount'] = {"value": "10000", "currency": "SGD"}
  5. Change request['countryCode'] = "NL" to request['countryCode'] = "SG"
  6. Run ./start.sh on GitPod instance
  7. Visit the URL generated by GitPod instance
  8. Click on Drop-in
  9. Select GrabPay as the payment method you want to check out with

Environment:

requirements.txt

  • flask
  • Adyen == 7.1.1
  • python-dotenv===0.21.1

Browser

  • Chrome: v111.0

Iframe error in card component

Hi,
I set up the demo flask service for testing purpouses and I'm receiving a iframe error "The iframe has not configured - see suggestions in Console" inhibiting me from testing the card.

image

The issue has happened in both a windows 10 machine and a linux server. There are no suggestions printed out in any console I can think of, neither the browser debug console or the terminal running the service...

Any tips on how to get the component to work?

Regards.

README instructions don't work well for windows.

I think the following seemed to work but someone should re-verify and update the README accordingly. Perhaps even make a separate README for windows?

python3 -m venv venv
venv\Scripts\activate
pip install -r requirements.txt
set FLASK_ENV=development
venv\Scripts\activate
venv\Scripts\python.exe app/app.py

I think after creating a virtual environment, one should always just use venv\Scripts\* for python commands. But dunno, don't use windows much.

Adyen JS Encryption.

Is there a way of using this library to encrypt the payment data of my client? E.g expiry date and cvv.

Credit Card test scenario

The Credit Card payment test scenario currently verifies the Credit Card form is filled. Extend the test case to include an actual payment.

Note: Credit Card number text field and CVC are included within an iframe (security reasons)

Checkout version issue

There is an issue with the checkout version in component.html. It's currently 5.3.0 and should be updated to 5.4.0. This version is causing a bug with PayPal payments.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.