Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Crypto to PaymentSheet #4480

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

### PaymentSheet
* [Fixed] Embedded Payment Element (private beta) layout margins default to zero.

* [Added] Support for Crypto in PaymentSheet

## 24.4.0 2025-01-13
### PaymentSheet
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
Loading