Getting Started
This page walks you through the integration using the simplest option, the default mode (a purchase panel at the bottom of the page). It usually takes just a few minutes.
Step 1: Include the SDK
Add this line to the HTML of your product page, usually right before </body>:
<script src="https://sdk.rakufun.com/rakufun-universal.min.js"></script>Once included, the RAKUFUN purchase panel appears at the bottom of the page automatically after the page finishes loading.
Step 2: Set the Product Information
Right after that line, tell the SDK which product the current page is about. When the user clicks the purchase button in the panel, the SDK opens the RAKUFUN product page in a new tab and passes this information along.
<script>
rakufun.setUIProductData({
url: window.location.href, // Address of the current product page
title: "iPhone 15 Pro Max", // Product name
price: "189800", // Price, digits only, no ¥ or commas
images: ["https://example.com/iphone.jpg"] // Product images, full addresses
});
</script>This must come after the line that includes the SDK, otherwise you'll see rakufun is not defined.
Complete Example
Both steps together, with all 13 product fields. The first 4 are recommended; fill in the rest if you have them:
<!DOCTYPE html>
<html>
<head>
<title>My E-commerce Site</title>
</head>
<body>
<div class="product">
<h1>Nintendo Switch OLED</h1>
<p class="price">¥37,980</p>
</div>
<script src="https://sdk.rakufun.com/rakufun-universal.min.js"></script>
<script>
rakufun.setUIProductData({
// Recommended
url: window.location.href, // Address of the current product page
title: "Nintendo Switch OLED", // Product name
price: "37980", // Price, digits only, no ¥ or commas
images: ["https://example.com/switch-oled.jpg"], // Product images, more than one is fine
// Optional fields
description: "Latest Switch with a 7-inch OLED screen", // Description, truncated beyond 2000 characters
brand: "Nintendo", // Brand
condition: "New", // Condition, e.g. New / Used / Display item
minQuantity: "1", // Minimum order quantity, defaults to 1
maxStock: "30", // Maximum stock quantity, defaults to 99
shippingInfo: "0", // Shipping information
deliveryTime: "1-3 days", // Estimated delivery time
precautions: "Includes 1-year manufacturer warranty", // Precautions
productParameters: "Display: 7-inch OLED, Storage: 64GB" // Specifications
});
</script>
</body>
</html>For each field's type, default value, and more examples, see API Reference - Product Information Fields. There is also a timestamp field, generated by the SDK, which you don't need to pass.
Check That It Works
- Open your product page. The RAKUFUN purchase panel should appear at the bottom
- Click the purchase button in the panel. The RAKUFUN product page should open in a new tab, showing the product information you passed in
The panel is hidden by default for Japanese IPs. If you are testing from Japan, temporarily add rakufun.enableDebug(); before the code in Step 2. The panel will then show, with a DEBUG badge in the top-right corner of the page. Remember to remove that line after testing.
If the panel still doesn't show, see Default Mode - FAQ.
What's Next
What you've set up is the default mode (bottom panel). Next, depending on what you need:
- Want a different look: for example a purchase button below the price, a banner, or your own button design. See UI Modes, which compares the four options and helps you choose
- Want to try the purchase flow first: see Examples, which has a live demo you can click
- Want details on a method or field: see API Reference
Questions? Contact us: service@rakufun.com