Code Monkey home page Code Monkey logo

wp-pronamic-pay-adyen's Introduction

WordPress Pay Gateway: Adyen

Adyen driver for the WordPress payment processing library.

Build Status Coverage Status Latest Stable Version PHP from Packagist Total Downloads Packagist Pre Release License Built with Grunt Scrutinizer Code Quality Code Coverage Build Status Code Intelligence Status FOSSA Status

Adyen Notifications (webhooks)

The Pronamic Pay Adyen gateway can handle Adyen notifications via the WordPress REST API.

Route: /wp-json/pronamic-pay/adyen/v1/notifications

The WordPress REST API Adyen notifications endpoint can be tested with for example cURL:

curl --request POST --user username:password http://pay.test/wp-json/pronamic-pay/adyen/v1/notifications

WordPress Filters

pronamic_pay_adyen_checkout_head

add_action( 'pronamic_pay_adyen_checkout_head', 'custom_adyen_checkout_head', 15 );

function custom_adyen_checkout_head() {
	wp_register_style(
		'custom-adyen-checkout-style',
		get_stylesheet_directory_uri() . '/css/adyen-checkout.css',
		array(),
		'1.0.0'
	);

	wp_print_styles( 'custom-adyen-checkout-style' );
}

pronamic_pay_adyen_config_object

add_filter( 'pronamic_pay_adyen_config_object', 'custom_adyen_config_object', 15 );

function custom_adyen_config_object( $config_object ) {
	$style_object = (object) array(
		'base'        => (object) array(
			'color'         => '#000',
			'fontSize'      => '14px',
			'lineHeight'    => '14px',
			'fontSmoothing' => 'antialiased',
		),
		'error'       => (object) array(
			'color' => 'red',
		),
		'placeholder' => (object) array(
			'color' => '#d8d8d8',
		),
		'validated'   => (object) array(
			'color' => 'green',
		),
	);

	$config_object->paymentMethods = (object) array(
		'card' => (object) array(
			'sfStyles' => $style_object,
		),
	);

	return $config_object;
}

Production Environment

Dashboard URL: https://ca-live.adyen.com/
API URL: https://{LIVE_API_URL_PREFIX}-checkout-live.adyenpayments.com/checkout/v41/

Test Environment

Dashboard URL: https://ca-test.adyen.com/
API URL: https://checkout-test.adyen.com/v41/

Frequently Asked Questions

Why do I get the "Unable to instantiate the payment screen" notice?

Adyen says on August 12, 2019:

The "Unable to instantiate the payment screen" appears when Adyen doesn't have any available payment methods to display in our SDK.

Bancontact is exclusive to Belgium and I can see you in /paymentSession​ request, you set "countryCode" : "NL"​. Could you try setting this to BE​, then you should be able to see BCMC.

License

FOSSA Status

wp-pronamic-pay-adyen's People

Contributors

fossabot avatar remcotolsma avatar rvdsteege avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

wp-pronamic-pay-adyen's Issues

Backward compatibility from version `3` to `4`

The https://github.com/pronamic/wp-pronamic-pay-adyen/releases/tag/4.0.0-RC-1 release is breaking backward compatibility since the Adyen Web Drop-in version 5.14.0 configuration requires a clientKey and environment parameter.

Schermafbeelding 2022-05-17 om 16 35 21

https://docs.adyen.com/online-payments/web-drop-in#configure

I've already set it up to throw an exception when these parameters are empty:

if ( empty( $this->config->environment ) ) {
throw new \Exception(
'No Adyen environment configured.'
);
}
if ( empty( $this->config->client_key ) ) {
throw new \Exception(
'No Adyen client key configured.'
);
}

However, it is not very friendly for site owners that the Adyen gateway no longer works after an update.

We can inform site owners about this in different ways:

  1. Send an email notice.
  2. Show an admin notice.
  3. Add upgrade_notice in https://api.pronamic.nl/plugins/update-check/1.2/ response.
  4. Use https://wordpress.org/plugins/woocommerce-gateway-paypal-express-checkout/https://wordpress.org/plugins/woocommerce-paypal-payments/ tactics.

The upgrade_notice option is only shown on the /wp-admin/update-core.php page and not on /wp-admin/plugins.php:

Schermafbeelding 2022-05-17 om 16 31 52

Improve Adyen drop-in error handling

When a payment via the Adyen drop-in fails, we're currently blocking the entire drop-in component for 5 seconds:

dropin.setStatus( 'error', { message: error.message } );

setTimeout( () => {dropin.setStatus( 'ready' );}, 5000 );

Source: https://github.com/wp-pay-gateways/adyen/blob/b767d59242fd8c66bc9ba7eee34cd32c677771ad/js/src/checkout-drop-in.js#L36-L38

Instead, it would be better to add the error message elsewhere on the page — outside of the drop-in component — and leave the drop-in status unaffected (or reset by setting the status to ready).

Upgrading to Version `71`

Dear Pronamic Support Team,

I am writing to request assistance regarding the upcoming compliance deadline for co-badged cards using Visa/Mastercard and local EU schemes (Cartes Bancaires, Bancontact, Dankort) as informed by Adyen. We are using the Pronamic payment integration with the Adyen plugin on our WordPress website.

According to Adyen's recent communication, it's crucial to ensure that our payment integration complies with the new consumer choice scheme rules by December 31st, 2023. Key aspects to be addressed include:

  1. Integration Check and Upgrade: We need to verify and possibly upgrade our current Adyen integration to comply with the new requirements.

  2. Payment Scheme Identification: During checkout, our system should clearly identify available payment schemes with equal visual quality and clarity.

  3. Inclusion of Credit and Debit Card Options: Our checkout process must include options for both credit and debit cards without discrimination.

  4. Upgrading to Version 71: Adyen has released version 71, which includes compliance features. We need guidance on implementing this upgrade.

  5. Custom Modifications: If necessary, we might need to change credit card component names in our integration. Assistance on this would be appreciated.

  6. Support and Clarification: Any additional support or clarification regarding these changes would be greatly beneficial.

We understand the importance of adhering to these compliance requirements and wish to ensure a seamless transition. Your prompt assistance in guiding us through this upgrade process will be invaluable.

Thank you for your attention to this matter.

Internal HelpScout ticket: https://secure.helpscout.net/conversation/2484929624/26783?viewId=1425710

API key with `<` `>` characters not saved correctly?

AQEjhmfuXNWTK0Qc+iSAgGs2pumSSyZq83wBx2njw7HsO5ZLUOkQwV1bDb7kfNy1WIxIIkxgBw==-Wv4aChlSwcgW9Zg95hZtS6lfJjhm1JotSglgRAptJMc=-c7q6mccP<5=>8t?k

results in

AQEjhmfuXNWTK0Qc+iSAgGs2pumSSyZq83wBx2njw7HsO5ZLUOkQwV1bDb7kfNy1WIxIIkxgBw==-Wv4aChlSwcgW9Zg95hZtS6lfJjhm1JotSglgRAptJMc=-c7q6mccP8t?k

Only display Apple Pay payment method if supported

With for example WooCommerce, our Apple Pay gateway is displayed as payment method at checkout even though this might not be supported by the browser/device.

A customer shared below CSS to only display this payment method in Safari,

.payment_method_pronamic_pay_apple_pay {
	display: none
}

@media not all and (min-resolution:.001dpcm) {
	@supports (-webkit-appearance:none) and (display:flow-root) {
		/* Safari */
		.payment_method_pronamic_pay_apple_pay {
			display: block !important;
		}
	}
}

However, these CSS hacks seems to need updates on browser updates:

Another way to only display the Apple Pay payment method if applicable, would be by checking window.ApplePaySession as described in Checking for Apple Pay Availability.

Internal Help Scout ticket: https://secure.helpscout.net/conversation/1798706229/23596

Plugin Dependencies problem "Pronamic Pay" or "Pronamic Pay Premium"

@remcotolsma this prevents the plugin from being activated with https://github.com/pronamic/pronamic-pay-premium, is that correct?

Scherm­afbeelding 2024-05-15 om 16 59 01

Originally posted by @rvdsteege in b8b2fd0#commitcomment-142048382

Currently this plugin requires https://wordpress.org/plugins/pronamic-ideal/, but this add-on also works fine with the Pronamic Pay Premium plugin.

The "Requires Plugins" header is limited, we cannot use 'or' conditions.
https://make.wordpress.org/core/2024/03/15/wordpress-6-5-field-guide/

Shall we remove this header?

* Requires Plugins: pronamic-ideal

Problem with Blik payments on Adyen, no `IPv6` support?

Hi there, we have set up Adyen on our Gravity Forms and it works perfectly with card payments, but our Blik payments keep failing. We have the following error:

Adyen has sent us the following but I dunno what is causing it as we're using your plugin:

We just saw that you're receiving "ER_TX_NOTFOUND" as an acquirer response to your BLIK transactions (i.e. 1829454437223636).

This is most likely since BLIK's system currently only supports a maximum of 25 characters in their IP address parameter.

We would therefore recommend using IPv4 formatting. Hope this helps!

What do we need to sort on the plugin to get this working?

Internal HelpScout ticket: https://secure.helpscout.net/conversation/1797287842/23584/

It seems that Adyen has no restrictions on the shopperIP parameter:
https://docs.adyen.com/api-explorer/#/CheckoutService/v68/post/payments__reqParam_shopperIP

The shopper's IP address. In general, we recommend that you provide this data, as it is used in a number of risk checks (for instance, number of payment attempts or location-based checks).

Schermafbeelding 2022-02-28 om 11 31 32

If Blik doesn't allow IPv6 Adyen should fix their integration with Blik?

5c2e8f4

Auto submit versus show pay button

In #8 I initially removed the auto submit and showPayButton functionality. In the review from @rvdsteege was suggested to add this again:

Reüel

Re-add auto submit functionality in checkout-drop-in.js and set $configuration['showPayButton'] = false; here if only a single payment method from the below listed methods will be shown in drop-in.

$auto_submit_methods = array(
	PaymentMethodType::SWISH,
	PaymentMethodType::TWINT,
	PaymentMethodType::VIPPS,
	PaymentMethodType::UNIONPAY,
);

Previously in checkout-drop-in.js:

onSelect: dropin => {
let configuration = pronamicPayAdyenCheckout.configuration;
if ( false === configuration.showPayButton ) {
dropin.submit();
}
},

This avoids customers needing to select the payment method twice (e.g. in WooCommerce checkout and one more time in drop-in, even though there are no additional input fields for these methods in drop-in).

Remco

How do we know for sure that the dropin doesn't want to show additional input fields for these methods? Maybe no additional fields are shown now, but by using the dropin this can change? If no additional input is needed, can we use a direct payment flow via the /payments endpint?

Reüel

As discussed at Pronamic HQ, we could keep the pay button and try to submit drop-in for these methods. If additional input is needed in the future, this should then result in input validation errors (before the transaction is started at Adyen). Previously, we were also hiding the pay button to prevent duplicate transactions for a single payment, but that is handled differently now with the sessions implementation.

Swish
Country Code: SE
Currency: SEK

The Swish payment flow uses a QR code (desktop) or a redirect to the Swish app (redirect URL with swish:// protocol). Drop-in can handle this for us.

FYI, if I just start a Swish payment via the API integration, the following error occurs:

The handling of the Pending result code is not implemented.

TWINT
Country Code: CH
Currency: CHF

Seems to work with our API integration, with RedirectShopper result code.

Vipps
Country Code: NO
Currency: NOK

Seems to work with our API integration, with RedirectShopper result code.

China UnionPay
I can't remember how this one ended up in the auto-submit list. Seems to work fine with drop-in, without additional input fields. However, with our API integration, I get the following error message:

交易失败 [9200003]Empty req.

I'd suggest just using drop-in for this payment method.

We still have to process the above in #8.

Update Adyen Web Drop-in from version `3.23.0` to `5.14.0`

Documentation

To-do

Related issues

No action after clicking payment button on our Adyen payment page

We have a client with customers who are stuck in the Adyen checkout process:

I fill out all of the required information, check all the boxes, and click the Pay button, and nothing happens. The screen doesn't refresh, I do not get an error or decline message, it just doesn't do anything.

When I hit the pay button after filling in the CC info it just sits there. I have tried several different browsers as well as a different computer

But now there's another issue, every time I place the order and make the payment, the site refreshes back to the summary where I have to write the card numbers again.

Internal HelpScout ticket: https://secure.helpscout.net/conversation/1651496500/22827?folderId=1425710

We have no idea what is causing this yet. All we could come up with is the unimplemented resultCode = PresentToShopper:

https://github.com/wp-pay-gateways/adyen/blob/454a25ec153f6dd9e96d25a9951287375442188e/js/src/checkout-drop-in.js#L178-L188

I suggest we update the Adyen library to the latest drop-in integration:
https://docs.adyen.com/online-payments/web-drop-in

This guide explains our simplified Drop-in integration introduced in v5.0.0, released in October 2021. If you implemented Drop-in before v5.0.0 and want to upgrade your Drop-in version, refer to our guide for Drop-in integrated before v5.0.0.

I also suggest to drop the Web SDK integration:
https://docs.adyen.com/online-payments/classic-integrations/checkout-sdks/web-sdk

docs adyen com_online-payments_classic-integrations_checkout-sdks_web-sdk

Maybe related:

Add feature to customize the Merchant Order Reference

Request from customer:

Are we able to create a custom tag to be used as Merchant Order Reference in Adyen (like a dynamic invoice number)?

Internal Help Scout conversation: https://secure.helpscout.net/conversation/2282196531/25812?folderId=1425710

We'd like to add a custom reference (reference to a contract) to the Merchant Reference field, which currently consists of the Form ID and the entry ID.
Or we could use the Merchant Order Reference field (containing the entry ID right now) but that isn't the preferred field from the customers' perspective.

/**
* Merchant order reference.
*
* @link https://docs.adyen.com/api-explorer/#/CheckoutService/v68/post/payments__reqParam_merchantOrderReference
* @link https://docs.adyen.com/api-explorer/#/CheckoutService/v68/post/sessions__reqParam_merchantOrderReference
*/
$request->set_merchant_order_reference( $payment->format_string( $config->get_merchant_order_reference() ) );

Class does not exist `\Pronamic\WordPress\Pay\Gateways\Adyen\Integration`

Pronamic Pay standalone plugins like https://github.com/pronamic/wp-pronamic-pay-with-mollie-for-contact-form-7/blob/main/pronamic-pay-with-mollie-for-contact-form-7.php don't have the Adyen library bundled with them. If users install this add-on plugin it will result in an class does not exist error.

add_filter(
'pronamic_pay_gateways',
function( $gateways ) {
$gateways[] = new \Pronamic\WordPress\Pay\Gateways\Adyen\Integration(
[
'id' => 'adyen',
'name' => 'Adyen',
'mode' => 'live',
'dashboard_url' => 'https://ca-live.adyen.com/ca/ca/login.shtml',
]
);
$gateways[] = new \Pronamic\WordPress\Pay\Gateways\Adyen\Integration(
[
'id' => 'adyen-test',
'name' => 'Adyen - Test',
'mode' => 'test',
'dashboard_url' => 'https://ca-test.adyen.com/ca/ca/login.shtml',
]
);
return $gateways;
}
);

We could load the Adyen classes from this add-on, with the Jetpack autoloader library this is relative save?

Add support for recurring payments via Adyen

We had an internal Basecamp to-do for this since Jul 3, 2019:
https://basecamp.com/1810084/projects/10966871/todos/378755380

This feature was requested a few times since then:

This is a bit in line with the following issues:

Perhaps we should consider supporting recurring payments with another payment provider besides Mollie.

API-only payment methods not redirecting to action URL

Payment methods using the API-only integration do not always redirect to the payment action URL anymore. This results in the drop-in page being displayed and in case of for example iDEAL asking to select an issuer, even though the issuer has already been selected in a previous step.

Use Adyen's Apple Pay certificate

Wij zijn momenteel druk met het koppelen van Apple Pay aan ons Adyen account. Ik kreeg de volgende vraag van mijn development afdeling:

Is het mogelijk om (al dan niet zelf) de gebruikte SDK van Adyen te updaten van 3.15.0 naar minimaal 3.17.2 voor de checkout zodat er gebruik kan worden gemaakt van de Apple Pay Certificates van Adyen zelf.

Internal HelpScout ticket: https://secure.helpscout.net/conversation/1798706229/23596?folderId=1425710

It seems that using Adyen's Apple Pay certificate also has advantages:

You don't need to create your own Apple Pay certificate for your web integration because you can process payments through Adyen's Apple Pay certificate. The benefits of using Adyen's Apple Pay certificate are:

  • A faster way to add Apple Pay to your integration.
  • There is less configuration required.
  • You get access to new features.
  • Apple Pay enabled by default for your Pay by Link integration, if you have one.

Source: https://docs.adyen.com/payment-methods/apple-pay/web-drop-in?tab=_code_payments_code__2#set-up-apple-pay

I suggest we update to version 3.23.0 for now, version 4 or 5 is probably a too big step for now.

https://docs.adyen.com/online-payments/release-notes?integration_type=web&version=3.23.0

We should only set the onValidateMerchant when a custom Apple Pay certificatie is configured?

pronamicPayAdyenCheckout.paymentMethodsConfiguration.applepay.onValidateMerchant = ( resolve, reject, validationUrl ) => {
send_request(
pronamicPayAdyenCheckout.applePayMerchantValidationUrl,
{
validation_url: validationUrl
}
)
.then( validate_response )
.then( data => {
// Handle Apple error.
if ( data.statusMessage ) {
throw new Error( data.statusMessage, {
cause: data
} );
}
resolve( data );
} )
.catch( error => {
handle_error( error );
// Reject to dismiss Apple Pay overlay.
reject( error );
} );
};

We now make the onValidateMerchant call by default for the Apple Pay Component. However, you can also choose to make the call manually, in which case your onValidateMerchant call overrides the default.

Adyen » Klarna Pay Later » "have to be manually captured"

See comment by @rvdsteege: 1c1af53#commitcomment-55136573

@remcotolsma Should we do something to (inform about) payment capture?

All Klarna payments have to be manually captured within 28 days after authorisation, even if you have enabled automatic capture for other payment methods on your merchant account.

Source: https://docs.adyen.com/payment-methods/klarna

See for example WooCommerce + Sisow + Klarna Pay Later:

Multiple Adyen payments for single Pronamic Pay payment

Our current implementation of the Adyen drop-in can result in multiple payments at Adyen for a single Pronamic Pay payment. This is probably undesired as this is the only gateway integration where this is possible.

Multiple payments can occur in for example the following cases:

  • a card payment fails and is then tried again;
  • while a payment is being processed, the payment page can be reloaded and a 2nd payment can then be made.

This previously also resulted in an issue with a failed payment updating a later successfully paid payment in pronamic/wp-pronamic-pay#245.

Swish missing return parameter `redirectResult`

From customer:

Hi. How can I get more information on the error some of our customers is given on the redirect (back to us) after completed payment? Neither Adyen or Pronamic Pay shows any problem with the payment.
Payment method Swish.
{"code":"rest_missing_callback_param","message":"En eller flera parametrar saknas: redirectResult","data":{"status":400,"params":["redirectResult"]}}

/wp-json/pronamic-pay/adyen/v1/return/[Payment ID]?sessionId= …

Internal Help Scout ticket: https://secure.helpscout.net/conversation/2070739526/24807

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.