question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

menggunakan fungsi snap pay di component

See original GitHub issue
  1. bagaimana cara import <script src="https://app.sandbox.midtrans.com/snap/snap.js" data-client-key="<Set your ClientKey here>"></script> di react js component?

  2. bagaimana menggunakan snap.pay(‘SNAP_TOKEN’) di react js component?

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:12

github_iconTop GitHub Comments

13reactions
rizdaprasetyacommented, Dec 6, 2019

Hi @alfanzain kelihatannya Anda salah memahami. Bukan soal JQuery-nya tetapi yg bisa dicontoh dari link tersebut adalah metode agar bisa load 3rd party hosted library agar bisa digunakan di React.

Mengadopsi metode pada link tersebut, caranya untuk Snap: put following line in your /public/index.html

<script src="https://app.sandbox.midtrans.com/snap/snap.js"></script>

use it in your project:

window.snap.pay('<snap-token>')

… “apakah bisa React JS dicampur dengan jquery?” jawabnya : "Bisa. Bisa hancur. …

Anda bisa tanyakan lebih lanjut ke teman Anda, apa yang dimaksud “hancur” dalam konteks tersebut. Itu karena JQuery & React memiliki fungsi yg saling overlap dalam hal HTML/UI manipulation framework, dan punya 2 paradigma yang saling berbeda. Walaupun demikian pun menurut saya “hancur” juga bukan kata yg tepat.

Sedangkan Snap.js sama sekali bukan untuk HTML/UI manipulation framework, dan tidak ada paradigma yg bertentangan dengan React. Jadi sample case yang anda berikan kurang relevan.

Terima kasih.

(Funfact: github.com sendiri mengimplementasikan sebagian React dan sebagian JQuery di page-page yang berbeda. Dan tidak terlihat seperti “hancur”, tapi hal ini di luar topik diskusi)

Note: Keuntungan lain menggunakan Snap.js yg dihost di Midtrans adalah untuk memastikan faktor security dan akan otomatis mendapat versi paling update & secure.

4reactions
alfanzaincommented, Dec 4, 2019

apakah akan ada penyesuaian atau library untuk React JS ?

mengingat jalan seperti ini memang bisa https://github.com/facebook/create-react-app/issues/3007#issuecomment-357863643, tetapi disisi lain, React JS tidak untuk itu

karena pernah saya tanyakan kepada beberapa teman yang sudah mendalami React JS, “apakah bisa React JS dicampur dengan jquery?” jawabnya : “Bisa. Bisa hancur. Memakai React JS itu berarti memakainya untuk pengganti library seperti jquery. Jika masih pakai jquery dan semacamnya ya mending pakai jquery.”

semoga jadi pertimbangan

Read more comments on GitHub >

github_iconTop Results From Across the Web

Snap Integration Guide Documentation - Midtrans Docs
The table given below describes the components which are required to display Snap payment page. Element, Description. Client Key, The Client Key. For...
Read more >
Integrate Midtrans in Laravel with Snap API: Part 1
By using Midtrans, customers can choose to pay through many channels, such as credit cards, bank accounts (virtual accounts), Alfamart outlets, ...
Read more >
midtrans-client - npm
Official Midtrans Payment API Client for Node JS. ... Snap - Customizable payment popup will appear on your web/app (no redirection). doc ...
Read more >
Midtrans - Dokumentasi Petunjuk Integrasi Snap
Sebelum anda menampilkan halaman Snap dengan memanggil snap.pay Anda membutuhkan Client Key untuk mengisi nilai atribut data-client-key pada file snap.js . < ...
Read more >
Midtrans-CI, Mengkaktifkan Snap Midtrans Tahap III - YouTube
video ini adala cara mengaktifkan Snap midtrans untuk melakukan request transaksi ke midtransDownload Library Midtrans ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found