Crossing PayPal APIs - paypal-adaptive-payments

I am working on a PayPal integration solution whereby the client application+server need to make use of features in several APIs, Adaptive Accounts (specifically "AddPaymentCard"), Adaptive Payments (specifically "Chained Payments") and Merchant APIs.
Is it possible to use those APIs together?
For example, can I
Add one or more credit cards as the funding source(s) using "AddPaymentCard" Adaptive Accounts API. (client application)
Choose one of the credit cards as the "funding source" for "Pay" Adaptive Payments operation. (client application)
Then, after the fact, use Merchant API to do operations on transactions created in step 2, eg. Void (DoVoid). (server)
Let me elaborate on 3 here.
With payment created by Adaptive Payment's "Pay" operation, can I then void the transaction with the Merchant API?
eg.
devtools-paypal.com/apiexplorer/AdaptivePayments, PAY operation
actionType PAY
currencyCode USD
…
receiverList
receiver
amount 1.00
email testuser#hotmail.com
Response
{
    "responseEnvelope": {
        "timestamp": "2014-08-24T09:36:47.259-07:00",
        "ack": "Success",
        "correlationId": "5ffaa01a860d1",
        "build": "12382931"
    },
    "payKey": "AP-3N46701432081335J",
    "paymentExecStatus": "CREATED"
}      
Then, perform the transaction with
www.sandbox.paypal.com/cgi-bin/webscr?cmd=_ap-payment&paykey=AP-3N46701432081335J.
Then, can I perform a DoVoid operation (devtools-paypal.com/apiexplorer/PayPalAPIs) on the resulting transaction?
If 1+2 above is not possible, can I use REST API together with Adaptive Payments?
Store credit card using developer.paypal.com/webapps/developer/docs/api/#store-a-credit-card
Somehow create an order of "Adaptive Payments, Chained" with developer.paypal.com/webapps/developer/docs/api/#create-an-order
Thanks!

No. DoVoid is only good for Authorizations. The Pay API doesn't do authorizations, but rather it would do Preapprovals if you're using it that way. If you are working that way, though, you can use the Preapproval API's to manage those profiles accordingly.
Again though, DoVoid would only come into play when voiding authorizations processed via DoAuthorization, Express Checkout, or Payments Pro, which are all part of the "classic API".

Related

Cookies consent popup - Blocked a frame with origin "https://www.wtwco.com" from accessing a cross-origin frame

I am having issues with the below test scenario I am trying to automate using Cypress:
When I navigate to http://www.willistowerswatson.com/ICT, a pop-up for cookies is displayed. I think it's an iframe:
I want to click the "Agree and Proceed" button in order to verify text on the landing page.
Here is my current test code:
 it('Navigate to landing page', () => {
        cy.visit('http://www.willistowerswatson.com/ICT');
        cy.frameLoaded('[id^=pop-frame]')
})
When I run this test, I get this error message in Cypress explorer:
Blocked a frame with origin "https://www.wtwco.com" from accessing a
cross-origin frame.
Can someone please tell me how I can get around this to proceed with the test scenario?
I could not replicate your screenshot. I only saw the cookie banner at the bottom of the page. There may be a cookie created after accepting and proceeding. You could create the cookie beforehand to bypass the the pop-up. You may also be able to click outside or hit esc to remove the pop-up as a workaround.

Use Iot hub edge module client to get device twin properties

I am trying to fetch device twin properties within an IoT Edge module, and while I am already connected with a module client (aka IoTHubModuleClient), I've found a method called get_twin() in the documentation that says that we can grab device or module twin properties. However, I am getting "empty" properties, here's the result:
{'desired': {'$version': 1}, 'reported': {'$version': 1}}
Which is not what I configured in the azure portal in device twin section. But using the IotHubDeviceClient with a device connection string (that's why I don't want to use that client), I am able to get the right device twin properties.
The code is pretty basic:
client = IoTHubModuleClient.create_from_edge_environment()
twin_properties = await client.get_twin()
logger.debug(f'Twin properties: {twin_properties}')
That is correct Mehdi, when you use the IoTHubModuleClient's get_twin method you are getting the module twin properties, you can add/modify/delete module twin properties independently of device twin properties.
Please take a look of this article

How to handle 3D card authentication through Stripe in node

I'm new to integrate stripe payment. I confused how to integrate 3D secure authentication. In my application on Backend platform using node with Hapi framework. Here is the some of code of paymnet intent which is given below.
let params = {
amount: 100,
currency: "CAD",
payment_method_types: ['card'],
payment_method: "card_1HqytjG6OdQYWdifbWxCrVGB", //cardId
customer: "users5fc1c5ff44d8605030499c00", //userId
}
let intent = await stripe.paymentIntents.create(params {
idempotencyKey: uuidv4());
let paymetConfirm = await stripe.paymentIntents.confirm(intent.id, intend.payment_method);
It's working fine with some of the test cards which not require 3D secure authentication.
4242424242424242
2223003122003222
Not working with these cards require 3D authentication)
4000002760003184
4000002500003155
So, when I check the response of the API (with 3D authentication card) return one of the sub-object is
next_action: {
type: 'use_stripe_sdk',
use_stripe_sdk: {
type: 'three_d_secure_redirect',
stripe_js: 'https://hooks.stripe.com/redirect/authenticate/src_1Hs1zhG6OdQYWdifEWTcyUvC?client_secret=src_client_secret_okgYE1A4eOovEFL9g0sgN29U',
source: 'src_1Hs1zhG6OdQYWdifEWTcyUvC'
}
},
When I take this URL and paste on the browser it redirects the page of 3d Secure, There are two option
complete authentication
fail authentication
Note-
Stripe SDK is set up only on the backend platform(Node)
My question is that
Is there any way not to confirm from the client-side, automatically confirm from the backend platform.
For the scenario, we have to set up a stripe SDK on the client-side(android,IOS).?
when I click on the URL which are inside next_action object which are given above,There are two option inside it,that is complete and failure authentication(3D page view) how to integrate clicking on itmy API hit respectively. how to achieve it?
Please help me.Thanks
Your payments are failing with 3DS enabled cards because you aren't authenticating them on the client. Your current flow of confirming server side won't work with 3DS enabled cards, as you aren't giving the user an opportunity to do the 3DS flow.
It's not really recommended to confirm the payment server-side, as it adds unnecessary round trips to the server without really adding anything. However if you do still want to confirm server side, Stripe has a guide on how to do that here: https://stripe.com/docs/payments/accept-a-payment-synchronously

Test google pay with stripe

I integrated google pay with stripe and configured test environment in google pay and stripe . Now i want to test it , its not accepting stripe test card to my google pay . Is there any specific test card for google pay ? Is it ok to add original card? , Are they going to charge any money in test environment?
We can use our real card for testing, but in Google-Pay's test mode and/or environment no amount will be charged.
(For India there will be a charge of $1, but in few minutes it reversed back into the same account.)
val googlePayLauncher = GooglePayPaymentMethodLauncher(
activity = this,
config = GooglePayPaymentMethodLauncher.Config(
environment = GooglePayEnvironment.Test,
merchantCountryCode = "IN",
merchantName = "merchantName"
),
readyCallback = ::onGooglePayReady,
resultCallback = ::onGooglePayResult
)
GooglePayEnvironment.Test test mode no amount will be charged

Stripe recurring payments for 3DS source

I want to use Stripe to charge cards recurrently every 30 days with amounts that oscilate.
From the docs I got that if there is a possibility that the card requires 3DS we should use Sources so I switched to sources ;)
From the source object stripe.js retrieves I look at three_d_secure param to decide whether to create a source object that requires 3DS or a normal card charging.
The flow:
With JS I get the source object that has three_d_secure set to either optional or required.
When it's set to optional after I retrieve the source with: source = Stripe::Source.retrieve(source_id) it looks like this:
"status": "chargeable",
"type": "card",
"usage": "reusable",
"card":{"exp_month":12,"exp_year":2032,"brand":"Visa",...
I attach it to a customer and charge it. I guess usage: reusable means that I can charge the card again later...
When three_d_secure=='required' I create a new source calling this:
source = Stripe::Source.create({
amount: amount,
currency: currency,
type: 'three_d_secure',
three_d_secure: {
card: source_id, #src_xcvxcvxcvc
},
redirect: {
return_url: return_url
},
})
I redirect the user to the URL Stripe provides, user enters his 3DS PIN and gets back to my return_url. When Stripe redirects the user back to my return_url I retrieve the source again and get something like this:
"status": "chargeable",
"type": "three_d_secure",
"usage": "single_use",
"three_d_secure": {"card":"src_1B1JzQHopXUl9h9Iwk05JV1z","authenticated":true,"customer":null}
I would expect that after passing the 3DS the source becomes reusable and chargeable until the date of expiry or so :|
My questions are:
1 Why is the 3DS source single_use? Is this like this only in sanbox environment or with the card I am using to test?
2 Can a 3DS protected card be charged again at all?
3 What's the correct approach to attach to customer sources (3DS or normal) that can be charged again and again?
Thank you!
Because it is a source payment token, not a source card token. It expires on a due date or when is consumed. You can use reusable token to create single_use tokens. reusable one represents a card source token
Yes if a 3ds is optional or not_supported, no if required. If required then every payement needs to fulfill a 3ds.
Steps:
Create an src_card_token for a card or use saved one (reusable)
Create an customer object with an src from src_card_token
Create an src_payment_token for a customer using one of his saved cards (as token)
fullfil a 3ds redirect process if required.
create a charge

Resources