LoginSignup
35
35

More than 5 years have passed since last update.

PAY.JP iOS SDKでApple Pay アプリ内支払いをする

Last updated at Posted at 2016-10-26

potatotips #34 (iOS/Android開発Tips共有会) のための投稿です

PAY.JP?

Payment Solution Provider(PSP)

https://developer.apple.com/apple-pay/

Apple Pay with 非対面決済

  • 実物の商品やサービスへの支払い
  • ECサイトや出前、タクシー、映画チケット
  • iOS App, Safari(Web)

BASEショップ30万店へ導入

BASE

大まかな作業手順

  1. developer.apple.comでマーチャントIDを登録
  2. PAY.JPで証明書署名要求をダウンロード
  3. developer.apple.comで証明書を作成
  4. PAY.JPへ証明書をアップロード

iOSアプリ実装

  1. PassKitのAPIで購入ボタンを表示
  2. 支払いリクエスト・アイテムを作成してペイメントシートを表示
  3. delegateメソッドで取得できるApple PayトークンからPAY.JPトークンを発行
  4. PAY.JPトークンをサーバーへ送信して決済処理を行う

ドキュメント

https://pay.jp/docs/apple-pay

PAY.JP iOS SDK beta

# Cartfile
github "payjp/payjp-ios"

# Podfile
pod 'PAYJP', git: 'git@github.com:payjp/payjp-ios.git'

トークン送信フロー

let apiClient = PAYJP.APIClient(publicKey: PAYJPPublicKey)
apiClient.createToken(with: payment.token) { (result) in
    switch result {
    case .success(let token):
        // tokenをサーバーへ送信して決済処理
        // https://pay.jp/docs/charge
        completion(.success)
    case .failure(let error):
        completion(.failure)
    }
}

動作確認

参考になる情報

Appendix

まとめ

  • PAY.JPでApple Pay対応を始めるのは簡単
    • お問い合わせ不要
    • SDKが公開されている
    • サンドボックス環境でテスト可能

FAQ

  • StripeやBraintreeのSDKと比較するとPAY.JPにするメリットある?
    • 対応ブランド
    • 契約プラン
    • 手数料
35
35
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
35
35