1.6 KiB
1.6 KiB
Basic Integration
Note: This integration is not recommended. Instead, try
PaymentSheet
, an embeddable native UI component that lets you accept 10+ payment methods with a single integration.
This example app demonstrates how to build a payment flow using our pre-built UI component integration (STPPaymentContext
).
To run the example app:
- If you haven't already, sign up for a Stripe account (it takes seconds).
- Open
stripe-ios/Stripe.xcworkspace
(notstripe-ios/Stripe.xcodeproj
) with Xcode - Fill in the
stripePublishableKey
constant instripe-ios/Example/Basic Integration/Basic Integration/CheckoutViewController.swift
with your Stripe test "Publishable key". This key should start withpk_test
. - Head to example-mobile-backend and click "Deploy to Heroku". Provide your Stripe test "Secret key" as the
STRIPE_TEST_SECRET_KEY
environment variable. This key should start withsk_test
. - Fill in the
backendBaseURL
constant in./Example/Basic Integration/Basic Integration/CheckoutViewController.swift
with the app URL Heroku provides (e.g. "https://my-example-app.herokuapp.com")
After this is done, you can make test payments through the app and see them in your Stripe dashboard.
Head to https://stripe.com/docs/testing#cards for a list of test card numbers.