Skip to content

Commit

Permalink
add crypto payment method to payment sheet
Browse files Browse the repository at this point in the history
  • Loading branch information
ericzhang-stripe committed Jan 24, 2025
1 parent 8d31fdb commit defc490
Show file tree
Hide file tree
Showing 19 changed files with 934 additions and 3 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@
### CardScan
* [Fixed] Fixed an issue where the UI layout was incorrect after Camera permissions were denied. ([#4487](https://github.com/stripe/stripe-ios/pull/4487)) (Thanks [@matheusbc](https://github.com/matheusbc)!)

### PaymentSheet
* [Added] Support for Crypto in PaymentSheet

## 24.4.1 2025-01-21
### ApplePay
* [Added] Added a `dismiss` method to `STPApplePayContext`.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -207,6 +207,22 @@ class PaymentSheetStandardLPMUIOneTests: PaymentSheetStandardLPMUICase {
XCTAssertTrue(app.staticTexts["Success!"].waitForExistence(timeout: 15.0))
}

func testCryptoPaymentMethod() throws {
var settings = PaymentSheetTestPlaygroundSettings.defaultValues()
settings.currency = .usd
settings.merchantCountryCode = .US
loadPlayground(app, settings)
app.buttons["Present PaymentSheet"].tap()

// Select Crypto
tapPaymentMethod("Crypto")

// Pay
app.buttons["Pay $50.99"].waitForExistenceAndTap()
webviewAuthorizePaymentButton.waitForExistenceAndTap(timeout: 10)
XCTAssertTrue(app.staticTexts["Success!"].waitForExistence(timeout: 15.0))
}

func testZipPaymentMethod() throws {
var settings = PaymentSheetTestPlaygroundSettings.defaultValues()
settings.layout = .horizontal
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -877,7 +877,34 @@
}
}
}
},
},
{
"type": "crypto",
"async": false,
"selector_icon": {
"light_theme_png": "https://js.stripe.com/v3/fingerprinted/img/payment-methods/[email protected]",
"light_theme_svg": "https://js.stripe.com/v3/fingerprinted/img/payment-methods/icon-pm-crypto-15fd4ffeafd1b13e40688c8a06d79ba4.svg",
"dark_theme_png": "https://js.stripe.com/v3/fingerprinted/img/payment-methods/[email protected]",
"dark_theme_svg": "https://js.stripe.com/v3/fingerprinted/img/payment-methods/icon-pm-crypto_dark-f19bb5c5400c6cde94dd53b7f1ce7217.svg"
},
"fields": [
],
"next_action_spec": {
"confirm_response_status_specs": {
"requires_action": {
"type": "redirect_to_url"
}
},
"post_confirm_handling_pi_status_specs": {
"succeeded": {
"type": "finished"
},
"requires_action": {
"type": "canceled"
}
}
}
},
{
"type": "mobilepay",
"async": false,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -317,7 +317,7 @@ extension PaymentSheet {
return []
case .alipay, .EPS, .FPX, .giropay, .grabPay, .netBanking, .payPal, .przelewy24, .klarna,
.bancontact, .iDEAL, .cashApp, .affirm, .zip, .revolutPay, .amazonPay, .alma,
.mobilePay, .swish, .twint, .sunbit, .billie, .satispay:
.mobilePay, .swish, .twint, .sunbit, .billie, .satispay, .crypto:
return [.returnURL]
case .USBankAccount:
return [
Expand All @@ -330,7 +330,7 @@ extension PaymentSheet {
return [.returnURL, .userSupportsDelayedPaymentMethods]
case .afterpayClearpay:
return [.returnURL, .shippingAddress]
case .link, .unknown, .crypto:
case .link, .unknown:
return [.unsupported]
@unknown default:
return [.unsupported]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ extension PaymentSheet {
.sunbit,
.billie,
.satispay,
.crypto,
.boleto,
.swish,
.twint,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -227,6 +227,16 @@ final class PaymentSheet_LPM_ConfirmFlowTests: STPNetworkStubbingTestCase {
}
}

func testCryptoConfirmFlows() async throws {
try await _testConfirm(intentKinds: [.paymentIntent],
currency: "USD",
paymentMethodType: .crypto,
merchantCountry: .US) { form in
// Crypto has no input fields
XCTAssertEqual(form.getAllUnwrappedSubElements().count, 1)
}
}

func testAlipayConfirmFlows() async throws {
try await _testConfirm(intentKinds: [.paymentIntent],
currency: "USD",
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit defc490

Please sign in to comment.