def checkout_with_shoppingcart(request, user, course_key, course_mode, amount):
 cart = Order.get_cart_for_user(user)
 cart.clear()
 enrollment_mode = course_mode.slug
 CertificateItem.add_to_order(cart, course_key, amount, enrollment_mode)
 cart.start_purchase()
 callback_url = request.build_absolute_uri(reverse('shoppingcart.views.postpay_callback'))
 payment_data = {'payment_processor_name': settings.CC_PROCESSOR_NAME, 'payment_page_url': get_purchase_endpoint(), 'payment_form_data': get_signed_purchase_params(cart, callback_url=callback_url, extra_data=[unicode(course_key), course_mode.slug])}
 return payment_data

def checkout_with_shoppingcart ( request , user , course_key , course_mode , amount ) : cart = Order . get_cart_for_user ( user ) cart . clear ( ) enrollment_mode = course_mode . slug CertificateItem . add_to_order ( cart , course_key , amount , enrollment_mode ) cart . start_purchase ( ) callback_url = request . build_absolute_uri ( reverse ( 'shoppingcart.views.postpay_callback' ) ) payment_data = { 'payment_processor_name' : settings . CC_PROCESSOR_NAME , 'payment_page_url' : get_purchase_endpoint ( ) , 'payment_form_data' : get_signed_purchase_params ( cart , callback_url = callback_url , extra_data = [ unicode ( course_key ) , course_mode . slug ] ) } return payment_data
create an order and trigger checkout using shoppingcart .