Apple Pay — Java
Implement Apple Pay on your own checkout when using Embedded Integration.
With Hosted Checkout, Apple Pay appears automatically on the DigetPay page — see Apple Pay on Hosted Checkout.
With Embedded Integration, you build checkout on your domain. Apple Pay must be implemented on your site; DigetPay processes the payment server-side after you obtain an Apple Pay token.
This guide applies only to Embedded Integration merchants. Do not use this for hosted checkout integrations.
Never send Apple Pay tokens directly from browser JavaScript to DigetPay. POST the token to your Java server first.
Concept guide: Apple Pay Embedded. Base client: Embedded Integration — Java.
High-level flow
sequenceDiagram participant Browser as Safari Browser participant Shop as Your Java Server participant Apple as Apple Pay participant API as DigetPay API Browser->>Shop: Load checkout page Shop->>Browser: ApplePaySession config Browser->>Apple: User authorizes Apple Pay Apple-->>Browser: Payment token Browser->>Shop: POST payment token Shop->>API: POST /payment/s2s/sale API-->>Shop: APPROVED / PENDING / 3DS html
Step 1 — Frontend (Safari)
Use the same Apple Pay JS pattern — onvalidatemerchant and onpaymentauthorized call your Spring endpoints at /apple-pay/validate-merchant and /apple-pay/process.
Step 2 — Merchant validation controller
@RestController
@RequestMapping("/apple-pay")
public class ApplePayController {
@PostMapping("/validate-merchant")
public ResponseEntity<Map<String, Object>> validateMerchant(@RequestBody Map<String, String> body) {
String validationUrl = body.get("validationURL");
// POST to Apple's validationURL with merchant identity certificate
return ResponseEntity.status(501)
.body(Map.of("error", "Implement with DigetPay-provided merchant certificate"));
}
@PostMapping("/process")
public ResponseEntity<Map<String, String>> processApplePay(@RequestBody Map<String, Object> body) {
Object token = body.get("token");
String orderId = (String) body.get("orderId");
// Map token to embedded sale payload — confirm with DigetPay
return ResponseEntity.ok(Map.of("status", "pending_implementation"));
}
}Confirm with DigetPay: Apple Pay token field mapping for embedded sale payload before production.
Step 3 — Domain verification
Host apple-developer-merchantid-domain-association at:
https://yourdomain.com/.well-known/apple-developer-merchantid-domain-association
See Apple Pay Domain Verification.
Staging vs production
| Environment | API base |
|---|---|
| Fin staging | https://fin-api.digetpay.com/v1 |
| Production | https://api.digetpay.com/v1 |
Next steps
Updated about 1 month ago
