This documentation explains how to run the connections processors code. There are some settings that need to be altered in order to do this.
The API key that is included in the Stripe.ts
file is valid and you can use it if you wish.
The style guide for formatting this code can be found here.
Go to the integrations page for your Stripe account. Here you can tell the Stripe API to accept non-tokenized card numbers.
Stripe offers test cards that will return varying responses.
Replace the value of cardNumber
in main.ts
with a card number on the list found here.
4111111111111111
: an accepted card number4000000000000002
: a declined card number
The stripe API accepts form-data
. When adding methods that send POST
data with bodies, encode the data you wish to send as form-data
and set the Content-Type
header to application/x-www-form-urlencoded
.
Some parameters are set in the POST
data to achieve the desired PaymentIntent
confirm and capture behaviour.
Setting the confirm
parameter to true
allows the paymentIntent
to be captured with no further confirmation action needed on the paymentIntent
.
If this parameter is not set to true
the paymentIntent
status will be set to requires_confirmation
and will not be capture-able until confirmed. See here for more details.
The Stripe API is configured to automatically set a paymentIntent
to captured
immediately after they are authorized. This behaviour can be overridden by setting the capture_method
parameter to manual
.
To add payment methods that are not registered on a Stripe account the payment_method_data
parameter will accept payment method details.
This is a hash object which must be provided a type
key (in this case it is hard-coded to card
). On this hash a card object
may be attached. Details can be found here.
The result of setting the parameter payment_method_data
is the payment_method
parameter is set with the payment details you provide. Details such as card number and expiration year can now be set. See here for more details.
The paymentIntent
object is described here.
The status
parameter on the returned paymentIntent
object will be set to requires_capture
,
Requires the paymentIntent
id of the paymentInten
you wish to capture.
The paymentIntent
object is described here.
The status
parameter on the returned paymentIntent
object will be set to succeeded
.
Requires the paymentIntent
id of the paymentInten
you wish to cancel.
The paymentIntent
object is described here.
The status
parameter on the returned paymentIntent
object will be set to canceled
.