简体   繁体   English

Flutterwave 与 Ionic 4 的集成

[英]Flutterwave Integration with Ionic 4

Invalid Public Key Passed please am having issue during payment process, this is what i received "invalid public key passed" The api has been returning this error for days now, what is the problem?无效的公钥传递请在付款过程中遇到问题,这是我收到的“无效的公钥传递” API 已经返回这个错误好几天了,是什么问题? i am using the live pubkey and secret key from my dashboard.我正在使用仪表板中的实时公钥和密钥。

this.rave.Card.charge( this.rave.Card.charge(

  {

    "PBFPubKey":"FLWPUBK-33223e3cd910016924752a8373518225-X",

    "cardno": "5438898014560229",
    "cvv": "564",
    "expirymonth": "10",
    "expiryyear": "20",
    "currency": "NGN",
    "country": "NG",
    "amount": "10",
    "email": "user@gmail.com",
    "phonenumber": "0902620185",
    "firstname": "temi",
    "lastname": "desola",
    "IP": "355426087298442",
    "txRef": "MC-" + Date.now(),// your unique merchant reference
    "meta": [{ metaname: "flightID", metavalue: "123949494DC" }],
    "redirect_url": "https://rave-webhook.herokuapp.com/receivepayment",
    "device_fingerprint": "69e6b7f0b72037aa8428b70fbe03986c"
  }
).then(resp => {
  console.log(resp.body);

  this.rave.Card.validate({
    "transaction_reference": resp.body.data.flwRef,
    "otp": 12345
  }).then(response => {
    console.log(response.body.data.tx);
    console.log(response.body);

  })

}).catch(err => {
  console.log(err);

})

Step 1 : Get the Flutterwave-Angular-v3 here [https://github.com/Flutterwave/Flutterwave-Angular-v3]第 1 步:在此处获取 Flutterwave-Angular-v3 [https://github.com/Flutterwave/Flutterwave-Angular-v3]

run either of these commands depending on your runtime environment根据您的运行时环境运行这些命令中的任何一个

      npm install flutterwave-angular-v3 

              or


    yarn  add  flutterwave-angular-v3

step 2 : Import FlutterwaveModule to the app root module ie app.module.ts file and declare it in your imports array.第 2 步:将 FlutterwaveModule 导入应用根模块,即 app.module.ts 文件,并在您的导入数组中声明它。

import { FlutterwaveModule } from "flutterwave-angular-v3"从“flutterwave-angular-v3”导入 { FlutterwaveModule }

 @NgModule({ declarations: [ AppComponent ], imports: [ BrowserModule, FlutterwaveModule ], providers: [], bootstrap: [AppComponent] })

you have 2 options to either use in code or use as a component , depending on the architectural pattern of your application.您有 2 个选项可以在代码中使用作为组件使用,具体取决于应用程序的架构模式。 the README.md on the link is well explanatory.链接上的 README.md 很好地解释了。

step 3 : for the purpose of this question choose第 3 步:为了这个问题的目的,选择

Use in Code, Method 2 (Promise): Async Payment Response在代码中使用,方法 2(承诺):异步支付响应

 import {Component} from '@angular/core'; import {Flutterwave, AsyncPaymentOptions} from "flutterwave-angular-v3"

(so you are able to get a promise back and do whatever you wish programmatically with your response data).. (所以你可以得到一个承诺,并用你的响应数据以编程方式做任何你想做的事情)。

Now fire up chrome and test your application, this should work fine on chrome when pay button is clicked prompting up the https://flutterwave.com/ng/ payment page modal,现在启动 chrome 并测试您的应用程序,当点击支付按钮提示https://flutterwave.com/ng/支付页面模式时,这在 chrome 上应该可以正常工作,

P:S if you are building Natively (ie on device), you might encounter issues, worthy of note is running into an infinite loop when you click on the pay button, and you have a white blank screen that just keeps showing the loading icon.. resolve this by whitelisting https://cordova.apache.org/docs/en/9.x/reference/cordova-plugin-whitelist/ in your Config.xml file ..... P:S 如果您是本地构建(即在设备上),您可能会遇到问题,值得注意的是,当您单击支付按钮时会陷入无限循环,并且您有一个白色的空白屏幕,它一直在显示加载图标.. 通过在 Config.xml 文件中将https://cordova.apache.org/docs/en/9.x/reference/cordova-plugin-whitelist/列入白名单来解决此问题.....

Kindly ensure that these configs are included in the config.xml file :请确保这些配置包含在 config.xml 文件中:

 <access origin="*" subdomains="true" /> <allow-intent href="http://*/*" /> <allow-intent href="https://*/*" /> <allow-navigation href="*" />

after this, delete your respective platform build folder and rebuild ie在此之后,删除您各自的平台构建文件夹并重建即

 ionic cordova build android

OR或者

 ionic cordova build ios

now serve your project again and start testing, this should work fine on your device or simulator perfectly now.现在再次为您的项目提供服务并开始测试,这现在应该可以在您的设备或模拟器上完美运行。 incase you get different error reach out on their forum https://developer.flutterwave.com/discuss , you sure will get an answer within record timing, their Engineers are doing an Amazing job..如果您在他们的论坛https://developer.flutterwave.com/discuss上遇到不同的错误,您肯定会在创纪录的时间内得到答案,他们的工程师正在做一项了不起的工作..

if you get this working consider yourself approved the status of Jedi, and please mark this answer.如果你得到了这个工作,请考虑你自己批准了绝地的地位,并请标记这个答案。

make sure you go to your dashboard and under settings->API the copy the public key.确保您转到仪表板并在设置-> API 下复制公钥。 Also note that the package was built for ionic 3 and not ionic 4. you can use this package for ionic 4 [rave ionic 4] ( https://www.npmjs.com/package/rave-ionic4 ).另请注意,该软件包是为 ionic 3 而不是 ionic 4 构建的。您可以将此软件包用于 ionic 4 [rave ionic 4] ( https://www.npmjs.com/package/rave-ionic4 )。

I updated the current one for ionic 3 to work for ionic 4我更新了当前的离子 3 以适用于离子 4

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM